카테고리 없음

연필 먹는 여우의 모임 : 커피에 젖은 각본 3차시 과제

keleck 2023. 8. 2. 04:38

function tt3(n) {
    var n = prompt();
        for(var i = 1 ; i <= 5 ; i++){
            const rand_0_n = Math.floor(Math.random() * n);
            console.log(rand_0_n);
    }
}
tt3(5);

끝번호를 입력받아 랜덤으로 5개의 숫자를 출력하는 함수.

 

function tt4(a, arr) {
    const re = arr[1,2,3];
    for(let i = 0 ; i < 3 ; i++){
        re[i] += a[i];
    }
    return re;
}

배열에 숫자 3개를 저장한 후 모두 더해 반환하는 함수.

 

<!DOCTYPE html>
<html lang="en">
<body>
    <button onclick="popup()">눌러</button>
    <script>
        function popup(){
            window.open('https://unifox.kr/','팝업','width=500, height=500');
        }
    </script>
</body>
</html>

버튼을 클릭하면 모니터에 가로 500px 세로 500px 크기로 팝업창이 열리고 팝업창에는
unifox 사이트가 표시되는 코드.