Note that a variable can store values of different types throught a program. It is not constrained to the data type of the initial value we give it at creation:
let a = "peanut";
console.log(typeof a); // Output: string
a = false;
console.log(typeof a); // Output: boolean
a = 13.7;
console.log(typeof a); // Output: number
Assignment
Follow the Coding Tutorial and let's practice with data types!
Hint
Look at the examples above if you get stuck.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
