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
Зареєструйся Зараз
або Підпишись на майбутні тести