DEV Community

Discussion on: 7 Useful Javascript Tips

Collapse
 
veljko94pesic profile image
veljko94pesic

Maybe you should mention that double tilde operator (~~) for negative numbers acts like Math.ceil() function, in your example:

const x = -1.5
const y = ~~x

console.log(y) // Equals -1

Nice article btw :)

Collapse
 
__victorchan profile image
Victor Chan

Awesome, didn't know about that. Thanks for sharing!