What is the output to console of the following code var dayO

What is the output to console of the following code? var dayOfTheWeek = \"Monday\"; var aNumber = 5; if ( dayOfTheWeek == \"Monday\" && aNumber < 5 ) { console.log(\"Number is smaller than 5\"); } else if ( dayOfTheWeek == \"monday\" || aNumber < 6 ) { console.log(\"Number is smaller than 6\"); } else { console.log(\"The number is not smaller than 6\"); }

A. Number is smaller than 5 B. Number is smaller than 6 C. The number is not smaller than 6 D. Nothing, no output

Solution

Ans : B . Number is smaller than 6 as dayOfTheWeek = \"Monday\" and aNumber = 5

so it will go into else if ( dayOfTheWeek == \"monday\" || aNumber < 6 ) { console.log(\"Number is smaller than 6\"); }

dayOfTheWeek == \"monday\" - true

aNumber < 6--->true as aNumber=5

true ||true= true

What is the output to console of the following code? var dayOfTheWeek = \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site