...

/

Discussion: Casting Spells with 1s and 0s

Discussion: Casting Spells with 1s and 0s

Execute the code to understand the output and gain insights into how to use the tilde operator to convert a floating-point number into an integer in JavaScript.

Verifying the output

Now, it’s time to execute the code and observe the output.

Press + to interact
const x = ~~(7.9);
console.log(x);

Bitwise NOT operator

The tilde (~) symbol in JavaScript ...