변수가 현재 범위에서 발견되지 않으면 JS 엔진은 전역 스코프에 도달 할 때까지 상위 점수를 찾습니다.window.someRandomVar와 someRandomVar의 차이점
이제, 브라우저에서 나는
console.log(someRandomVariable);
// This throws ReferenceError as someRandomVariable is Not found on Global/Window scope.
아래하려고하면하지만 윈도우 객체에 명시 적으로 호출 할 때, 그것은 정의되지 않은 보여줍니다.
console.log(window.someRandomVariable)
내 이해에 따르면 전자는 특정 기능 범위 안에 있지 않기 때문에 창 개체도 검색합니다.
2 가지 동작이 다른 이유는 무엇입니까?