The following short program demonstrates how the split()
function works on a simple string:
let sentence = "the quick brown fox jumped over the lazy dog"; let words = sentence.split(" "); for (let i = 0; i < words.length; ++i) { console.log("word " + i + ": " + words[i]); }