var test = {
names: ['kim', 'justin', 'aqua'],
fn: function () {
test.names.forEach(() => {
console.log(this)
})
},
}
test.fn();
var test = {
names: ['kim', 'justin', 'aqua'],
fn: function () {
test.names.forEach(function () {
console.log(this)
})
},
}
test.fn();
<button id="button"> 버튼 </button>
<script>
document.getElementById('button').addEventListener('click',
(e) => {
console.log(this);
});
</script>
선언 | 재선언 | 재할당 | 범위 |
var | O | O | function |
let | X | O | {} |
const | X | X | {} |
console.log(name);
var name = "cookyman"
cosole.log(name);
// 가장 바깥쪽에 선언해도 되긴 하나..
window.nickname = 'cookyman'
WebPack의 기초 (0) | 2022.03.28 |
---|---|
맥OS M1 실리콘에서 node 설치시 에러 대응법 (0) | 2021.10.21 |
NVM으로 Node.js 설치 및 버전 변경 관리 (0) | 2021.10.11 |
자바스크립트 개발자라면 알아야하는 핵심 33개 이론 | #1. Call Stack (0) | 2021.10.11 |
댓글 영역