Assignments for The Complete JavaScript Course by Jonas Schmedtmann Help

Type Conversion and Coercion

  1. Predict the result of these 5 operations without executing them:

console.log('9' - '5'); // -> ? console.log('19' - '13' + '17'); // -> ? console.log('19' - '13' + 17); // -> ? console.log('123' < 57); // -> ? console.log(5 + 6 + '4' + 9 - 4 - 2); // -> ?
  1. Execute the operations to check if you were right.

console.log('9' - '5'); // -> 4 console.log('19' - '13' + '17'); // -> '617' console.log('19' - '13' + 17); // -> 23 console.log('123' < 57); // -> false console.log(5 + 6 + '4' + 9 - 4 - 2); // -> 1143