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.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты