$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #37

What is the output?

const n = 7;
console.log(n % 2 === 0 ? "even" : "odd");
  1. even
  2. odd
  3. true
  4. 1
7 is not divisible by 2, so the ternary returns "odd".
Play Problem Solving ▸