Skip to content

Instantly share code, notes, and snippets.

@inspector-ambitious
Last active December 14, 2021 14:56
Show Gist options
  • Select an option

  • Save inspector-ambitious/4b4d1a9d5b2696686aadb21ec22175c6 to your computer and use it in GitHub Desktop.

Select an option

Save inspector-ambitious/4b4d1a9d5b2696686aadb21ec22175c6 to your computer and use it in GitHub Desktop.
// Step 1: Create a function that will return the number of words in a text
const countWords = (text) => {
}
console.log(countWords("")); // 0
console.log(countWords(" ")); // 0
console.log(countWords("JavaScript !!! ")); // 1
console.log(countWords(" JavaScript")); // 1
console.log(countWords(" JavaScript is cool ")); // 3
// Step 2: Create a function that render all the words as follow
// <ul>
// <li>word1</li>
// <li>word2</li>
// </ul>
const renderWords = (text, rootEl) => {
};
renderWords(" JavaScript is cool !", document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment