Sign in
Log inSign up

Bitwise Not operator in javascript

Default profile photo
Anonymous
·Mar 19, 2018

var num1 = 25 // binary 11001

var num2 = ~num1 // binary 111111111111111100110

alert(num2) = -26;

In the above scenario I am applying bitwise not operator to num1, but after alerting the value I am getting -26 which is totally different from the binary value

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct