일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 다익스트라
- Two Points
- Stored Procedure
- two pointer
- SQL
- MYSQL
- String
- Hash
- Brute Force
- 이진탐색
- DP
- Dijkstra
- 스토어드 프로시저
- binary search
- 그래프
- Trie
- union find
Archives
- Today
- Total
codingfarm
var와 let, const 본문
var 키워로 선언된 변수는 같은 스코프 내에서 중복 선언이 허용된다.
1
2
3
4
5
6
|
function foo(){
var x = 1;
var x = 2;
console.log(x);
}
foo();
|
cs |
하지만 let이나 const 키워드로 선언된 변수는 같은 스코프 내에서 중복 선언을 허용하지 않는다.
1 2 3 4 5 6 | function foo(){ let x = 1; let x = 2; console.log(x); // SyntaxError: Identifier 'x' has already been declared } foo(); | cs |
'Programming Language > JavaScript' 카테고리의 다른 글
변수의 생명주기 (0) | 2021.03.08 |
---|---|
스코프(scope) (0) | 2021.03.07 |
함수 (0) | 2021.03.04 |
원시 값과 객체의 비교 (0) | 2021.02.17 |
객체 리터럴 (0) | 2020.11.15 |
Comments