Loading workspace environment...
Explore the fundamental types of data: Numbers, Strings, and Booleans.
42 or 3.14Number primitive (integers and decimals)."Hello, World!"String primitive (sequence of text characters).true or falseBoolean primitive (binary logical truth values).typeof variableReturns the type name of the variable as a string.const age = 25;
const username = "CodeExplorer";
const isSubscribed = true;
console.log("age is a:", typeof age, "(Value:", age, ")");
console.log("username is a:", typeof username, "(Value:", username, ")");
console.log("isSubscribed is a:", typeof isSubscribed, "(Value:", isSubscribed, ")");age is a: number (Value: 25 )
username is a: string (Value: CodeExplorer )
isSubscribed is a: boolean (Value: true )typeof ageEvaluates to the string "number".typeof usernameEvaluates to the string "string".const a = "10";
const b = "20";
console.log(a + b); // Prints "1020", not 30!const a = 10;
const b = 20;
console.log(a + b); // Prints 30Architectural Explanation: Numbers in quotes are treated as text strings. Adding strings glues them together (concatenation).
console.log(typeof "123");Create 3 variables: your favorite city (string), temperature in degrees (number), and whether it is currently raining (boolean). Log all 3 with their types.