What will be the result of the code?

  var a = '1';
  var b = 1;
  res = (a == b) + ',' + (a === b);
  alert(res);
Explanation
In this example, when using equal operator (==) first two variables are convert to numeric type, and only then their values are compared. The operator strict equal (===) firstly checks the types of variables, and if they match, it comparing their values.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
JavaScript quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes