Q:

Write a JavaScript program to convert a given string into an array of words

0

Write a JavaScript program to convert a given string into an array of words.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const words = (str, pattern = /[^a-zA-Z-]+/) => str.split(pattern).filter(Boolean);
console.log(words('I love javaScript!!')); 
console.log(words('python, java, php'));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now