๐ฉ ๋ณ์ ํ์
number
๐ ์ค๋ช
- ์ซ์๋ฅผ ๋ํ๋ผ ๋ ์ฌ์ฉํ๋ ๋ณ์
โ๏ธ ์ฌ์ฉ๋ฒ
์
๋ ฅ
let integer = 123;
let negative = -123;
let double = 1.23;
let binary = 0b1111011;
let octal = 0o173;
let hex = 0x7b;
console.log(0 / 123);
console.log(123 / 0);
console.log(123 / -0);
console.log(123 / "aa");
์ถ๋ ฅ
- ์ด๋ฏธ์ง๋ก ๋์ฒด
string
๐ ์ค๋ช
- ๋ฌธ์์ด์ ๋ํ๋ผ ๋ ์ฌ์ฉํ๋ ๋ณ์
โ๏ธ ์ฌ์ฉ๋ฒ
์
๋ ฅ
let string = "์๋
ํ์ธ์";
string = `hello`;
console.log(string);
string = "'๋ฐ์ดํ๊ฐ ๋ณด์ด๊ฒ ์ถ๋ ฅ'";
console.log(string);
string = '๋๊ฐ์ \'๋ฐ์ดํ\' ์ฌ์ฉ';
console.log(string);
string = "โ ์ค๋ฐ๊ฟ\n ํญํค ์ฌ์ฉ\t ๋ฐฑ์ฌ๋์ ๋๋ฒ\\ ์ ๋์ฝ๋ \u0d00 \n";
console.log(string);
let id = "Rainy";
let greetings = "์๋
ํ์ธ์ " + id + "๋ \n์ฆ๊ฑฐ์ด ํ๋ฃจ ๋ณด๋ด์ธ์";
console.log(greetings, "-์ ํต์ ๋ฐฉ๋ฒ\n");
greetings = `์๋
ํ์ธ์ ${id}๋ ์ฆ๊ฑฐ์ด ํ๋ฃจ ๋ณด๋ด์ธ์`;
console.log(greetings, "-ํ
ํ๋ฆฟ ๋ฆฌํฐ๋ด");
console.log("");
console.log("1 + 1 = 2");
console.log(`1 + 1 = ${1 + 1}`);
์ถ๋ ฅ
- ์ด๋ฏธ์ง๋ก ๋์ฒด
boolean
๐ ์ค๋ช
- boolean ํ์
. true/false๋ฅผ ๋ํ๋ผ ๋ ์ฌ์ฉํ๋ ๋ณ์
โ๏ธ ์ฌ์ฉ๋ฒ
์
๋ ฅ
let aa = true;
console.log("๋ณ์ aa๋", aa);
console.log("๋ณ์ aa๋", !aa);
console.log(0);
console.log(!0);
console.log("");
console.log("============= falsy ๊ฑฐ์ง์ธ ๊ฐ =============");
console.log(!!0);
console.log(!!-0);
console.log(!!"");
console.log(!!null);
console.log(!!undefined);
console.log(!!NaN);
console.log("");
console.log("============= truthly ์ฐธ์ธ ๊ฐ =============");
console.log(1);
console.log(-1);
console.log("๋ฌธ์์ด");
console.log({});
console.log([]);
console.log(Infinity);
console.log("");
console.log("============= ์์ฉ =============");
let bb;
console.log("๋ณ์ bb๋?", !!bb);
console.log(3 < 2);
console.log(3 == 2);
console.log(3 > 2);
์ถ๋ ฅ
- ์ด๋ฏธ์ง๋ก ๋์ฒด
empty (null, undefined)
๐ ์ค๋ช
- ๊ฐ์ด ์๋ ์ํ๋ฅผ ๋ํ๋ด๊ธฐ ์ํ ๋ณ์
โ๏ธ ์ฌ์ฉ๋ฒ
์
๋ ฅ
let vari;
console.log(vari);
vari = null;
console.log(vari);
console.log("");
let activeItem;
console.log("๋ณ์ activeItem : ", activeItem);
activeItem = null;
console.log("null activeItem : ", activeItem);
console.log("typeof null : ", typeof null);
์ถ๋ ฅ
- ์ด๋ฏธ์ง๋ก ๋์ฒด
๐ ์ฐธ๊ณ ๋งํฌ & ๋์์ด ๋๋ ๋งํฌ