Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
How do you easily go to the next item inside an Array?

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!