민지짱민지최고 2023. 10. 17. 09:27

// 내장 객체들 : window(최상위객체), document, history, location ... 


        // 1. history
        function test1(){

            // 1-1. 뒤로가기 (보통 한페이지만 뒤로가니까ㅎㅎ)
            history.back(1);    // == history.go(-1);
        }

        // 2. location
        function test2(){

            // 2-1. JS의 a tag처럼 이동가능
            // location.href = "https://www.naver.com";

            // 2-2. 현재 내위치 확인
            alert(location.href);
        }

        // 3. window - 모르겠다 패스!
        function test3(){
            var a = 10;
            console.log(a);
            console.log(window.a);
            this.b = 40;
        }