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

154
Views
Anyone know how to check if the index of an array item is even

I want to see if the index number of the array item is even, if it is then it should carry out a block of code;

var num = 122345643345673;
var convNum = num.toString();
var aftertoString = convNum.split(" ");
function luhnsAlg() {
for (let i = 0; i < aftertoString.length; i++) {
    if (aftertoString[i] == 2) {
        console.log("wow");
    }else{
        console.log("ohh");
    }
  }
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do :

let even = index % 2 == 0;

it will return true when even

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!