Numbers, strings, booleans, null and undefined, checked with typeof. Then see what + and * do when a string meets a number.
JavaScript · beginner · 6 min · 10 steps · free
const age = 36;
const name = 'Ada';
const isAdmin = false;
const nothing = null;
let notSet;
console.log(typeof age, typeof name, typeof isAdmin);
console.log(typeof nothing, typeof notSet);
const joined = '5' + 3;
const product = '5' * 3;
console.log(joined, product);age is created with the value 36.name is created with the value "Ada".isAdmin is created with the value false.nothing is null: "no value", set on purpose.notSet was never given a value, so it is undefined.number string boolean.+ with a string joins text: "5" + 3 becomes "53".* only works on numbers, so JavaScript turns "5" into 5: 15.53 15.Answer: "string"
Answer: 12. * converts both to numbers.
← Variables: let and const · Equality, Truthy and Falsy →