If/Else/Else if


#1

I don't understand the mistake in this exercise. The function part of the program was pre-written. Is my code wrong?

Thanks in advance!
Dhanya


#2

a single equal sign means assign, not check if things are equal


#3

you can put two 'equals to' in your 'if statement'

  if (number%2 == 0) {
      return true;
  }

#4

best practice is to always use ===

also @dhanyasreepremsankar conditions always evaluate to true or false

function myFn(n){
 return (n%2 === 0)
}

myFn(2)
//true
myFn(3)
//false

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.