JavaScript implict conversion to number

You can implict convert a string to number using the following operators - , / , *
let num;

num = '6' - '4'; 
console.log(num); // 2

num = '4' - 2;
console.log(num); // 2

num = '4' * 2;
console.log(num); // 8

num = '4' / 2;
console.log(num); // 2

Comments

Popular posts from this blog

Inserting and Moving elements inside Ruby Array

Difference between Validations, Callbacks and Observers