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

Difference between Validations, Callbacks and Observers