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

165
Views
Why does the %remainder operator returns the same results in this Even or Odd Checker in JavaScript

Why does this code "(number % 2)" work the same as this code "(number % 2 == 1)" even tho i didn't specify how much the remainder of the division should be?

var number = parseInt(prompt("even or odd number checker"));
if (number % 2) {
  alert("odd");
} else {
  alert("even");
}

var number = parseInt(prompt("even or odd number checker"));
if (number % 2 == 1) {
  alert("odd");
} else {
  alert("even");
}

about 4 years ago · Juan Pablo Isaza
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!