What will be the value of the variable apt?
 var apt = 2; apt = apt << 2; 
Explanation
JavaScript's Numbers are double-precision floats(*), the bitwise operators (<<,>>, &, | and ~) are defined in terms of operations on 32-bit integers. Doing a bitwise operation converts the number to a 32-bit signed int, losing any fractions and higher-place bits than 32, before doing the calculation and then converting back to Number.
Read more: Bitwise operators

@aalaminosz26 thanks for a feedback. updated explanation

2017 Dec 5, 3:49:20 PM

I don't understand the explanation. A link would be useful to understand terms like 32-bit ints, higher-place bits, bitwise operators, double-precision floats...

2017 Nov 25, 8:40:02 AM

Следи за CodeGalaxy

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

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