종류

특징

Number

const count            = 17;
const size             = 17.1;
const infinity         = 1 / 0;
const negativeInfinity = -1 / 0;
const nAn    = 'not a number' / 2;
const bigInt = 1234567890123456789012345678901234567890n;

console.log(`value: ${count}, type: ${typeof count}`); // value: 17, type: number
console.log(`value: ${size}, type: ${typeof size}`);   // value: 17.1, type: number 
console.log(`value: ${infinity}, type: ${typeof infinity}`); // value: Infinity, type: number
console.log(`value: ${negativeInfinity}, type: ${typeof negativeInfinity}`);
// value: -Infinity, type: number
console.log(`value: ${nAn}, type: ${typeof nAn}`);
// value: NaN, type: number
console.log(`value: ${bigInt}, type: ${typeof bigInt}`);
// value: 1234567890123456789012345678901234567890, type: bigint

String