I'm creating a random word generator which will contain a lot of words. I'm using the following code:
function gentext() {
var word=['example', 'word', '', '' , '', '', '', '', '', '', '', '', '',];
var para=document.querySelector('p');
para.innerHTML=word[Math.floor(Math.random()*word.length)];
}
In between the apostrophes I need to fill in all the other words to come. Is there an easy way to go immediately between the apostrophes instead of using the right arrow key several times inside Visual Studio Code?
You can write a small code for it, for example write all your words in a single string : `
let str = "word example cat dog eats monkey node angular javascript";
const word = str.split(" ");
console.log(word)
And you have your array as word.