This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 10 + 20은 평가되어 숫자 값 30을 생성한다. | |
10 + 20; // 30 | |
// 변수에는 10 + 20이 평가되어 생성된 숫자 값 30이 할당된다. | |
let sum = 10 + 20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 변수 선언문은 값으로 평가될 수 없으므로 표현식이 아니다. | |
let x; | |
// 표현식이 아닌 문은 값처럼 사용할 수 없다. | |
let foo = let x; // SyntaxError: Unexpected token var | |
// 할당문은 그 자체가 표현식이지만 완전한 문이기도 하다. 즉, 할당문은 표현식인 문이다. | |
x = 100; | |
//표현식인 문은 값처럼 사용할 수 있다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function foo() { | |
return; | |
{ | |
} | |
// ASI의 동작 결과 => return; {}; | |
// 개발자의 예측 => return {}; | |
} | |
console.log(foo()); // undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 모두 숫자 타입이다. | |
let interger = 10; // 상수 | |
let double = 10.12; // 실수 | |
let negative = -20; // 음의 정수 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log(10 / 0); //Infinity | |
console.log(10 / -0); //-Infinity | |
console.log(1 * "string"); // NaN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//문자열 타입 | |
let string; | |
string = "문자열"; // 작음따옴표 | |
string = "문자열"; // 큰따옴표 | |
string = `문자열`; // 백틱(ES6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var first = "Hyeon-jun"; | |
var last = "Moon"; | |
// ES5 : 문자열 연결 | |
console.log("My name is " + first + "" + last + "."); | |
// My name is Hyeon-jun Moon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let first = "Quato"; | |
let last = "Moon"; | |
// ES6 : 표현식 삽입 | |
console.log(`My name is ${first} ${last}.`); | |
// My name is Quato Moon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo = true; | |
console.log(foo); // true | |
foo = false; | |
console.log(foo); // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let foo; | |
console.log(foo); // undefined |