This conversion has a priority order that begins with stings, Number, and finally Boolean.
1. String coercion;
// jshint esversion:6 let num1 = 20; console.log(typeof(num1)); //number let num2 = " Twenty one"; console.log(typeof(num2)); // string let sum = num1 + num2; console.log(sum); //20 Twenty one console.log(typeof(sum)); // string
2. Number coercion
// jshint esversion:6 let num1 = 20; console.log(typeof(num1)); //number let num2 = true; console.log(typeof(num2)); // boolean let sum = num1 + num2; console.log(sum); //21 console.log(typeof(sum)); // number