What will be the result of the code?

  var a = '1';
  var b = 1;
  res = (a == b) + ',' + (a === b);
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