근데javascript변수메모리주소어떻게보지
-
[ES6] const ? 불변아니였어?Eureka! 2019. 10. 31. 16:53
제목이 조금 그렇죠? ES6에 들어와서 const에 대해서 왜 const로 선언된 배열이나 객체는 내부 값이 변경 가능한가? 라고 생각했던 적이 있어서 글을 써봅니다. 아래 코드를 보시죠 : ) const qux = 3; qux; // 3 qux = 5; // Uncaught TypeError: Assignment to constant variable. const baz = 'Hello!'; baz; // "Hello" baz = 'Hi!'; // Uncaught TypeError: Assignment to constant variable. (*역시 const인가 좋아!) const foo = { name : 'foo', age: 23 }; console.log..