Middle
What data types are available in Java?
sobes.tech AI
Answer from AI
JavaScript has the following main data types:
-
Primitive types:
Number— for numbers (integers and floating-point)String— for stringsBoolean— logical valuestrueorfalseUndefined— the value of a variable that has not been assigned a valueNull— a special value meaning "no value"Symbol— unique and immutable identifiersBigInt— for representing integers of arbitrary length
-
Objects:
Object— a collection of key-value pairs, including arrays, functions, and other complex structures
Example of using types:
let num = 42; // Number
let str = "Hello"; // String
let flag = true; // Boolean
let nothing; // Undefined
let empty = null; // Null
let sym = Symbol('id'); // Symbol
let big = 9007199254740991n; // BigInt
let obj = {name: "Ivan", age: 30}; // Object