JavaScript - Implict null to number conversion

// null is 0 when used with number
let num;  

num = 4 + null; 
console.log(num);  // 4  

num = 4 - null; 
console.log(num);  // 4

Comments

Popular posts from this blog

Inserting and Moving elements inside Ruby Array

Remove duplicates from a JavaScript Array

Sending Binary Data over the Network with Json