JS/JS 수업분 54

[JS] day11_Lotto과제

1~45까지의 중복되지 않는 숫자 6개를 랜덤으로 추출 => 출력 (set 객체를 사용) 랜덤번호 6개 생성 및 출력 당첨번호 7개 생성 및 출력 (마지막 번호는 보너스) 결과 확인 다시하기 " data-ke-type="html">HTML 삽입미리보기할 수 없는 소스    DOCTYPE html>html lang="en">head>    meta charset="UTF-8">    meta http-equiv="X-UA-Compatible" content="IE=edge">    meta name="viewport" content="width=device-width, initial-scale=1.0">    titl..

JS/JS 수업분 2023.04.18

[JS] day11_classEx (입금, 출금, 송금)

DOCTYPE html> class ex let myAccount = { //이름 name: 'hong', //잔액 balance: 0, //입금 deposit: function(amount){ this.balance += amount; }, //출금 withdraw: function(amount){ this.balance -= amount; }, //이체 transfer: function(amount, otherAccount){ this.balance -= amount; otherAccount.balance += amount; } }; let yourAccount = { //이름 name: 'kim', //잔액 balance: 100, //입금 deposit: function(amount){ this...

JS/JS 수업분 2023.04.18

[JS] day11_class, 객체, 생성자

DOCTYPE html> class, 객체, 생성자 // 클래스생성 class Car{ // 생성자 생성 // : 자바스크립트에서는 생성자는 오직 1개! 허용 constructor (name, year){ this.name = name; this.year = year; this.model = ''; } } // 객체생성 let myCar1 = new Car('쏘나타', 2022); let myCar2 = new Car('그랜저', 2022); let myCar3 = new Car(); myCar3.name = '아반떼'; myCar3.year = 2001; myCar3.model = 'XD'; let myCar4 = new Car('부릉부릉'); myCar4.year = 2023; console.log(..

JS/JS 수업분 2023.04.18

[JS] day11_mapEx

과목 : 점수 : 추가버튼 출력버튼 결과버튼 " data-ke-type="html">HTML 삽입미리보기할 수 없는 소스   DOCTYPE html>html lang="en">head>    meta charset="UTF-8">    meta http-equiv="X-UA-Compatible" content="IE=edge">    meta name="viewport" content="width=device-width, initial-scale=1.0">    title>Map 예제title>            추가버튼 : map에 추가        출력버튼 : map을 출력 (ul-li로 출력)        결과버튼 : ..

JS/JS 수업분 2023.04.18

[JS] day11_count생성 (더하기 버튼 : +1 / 빼기버튼 : -1)

더하기 빼기 리셋 0 " data-ke-type="html">HTML 삽입미리보기할 수 없는 소스     DOCTYPE html>html lang="en">head>    meta charset="UTF-8">    meta http-equiv="X-UA-Compatible" content="IE=edge">    meta name="viewport" content="width=device-width, initial-scale=1.0">    title>Count 만들기title>    head>body>    button type="button" id="plus">더하기button>    button type="button" id="miu..

JS/JS 수업분 2023.04.18

[JS] day11_try~catch

DOCTYPE html> try~catch console.log('프로세스 시작'); try{ alerttt('경고창 실행'); //명령어가 잘못된 부분 console.log('경고창 실행 확인'); }catch(err){ console.log('catch 영역'); console.log(err.name); //에러 이름출력 ReferenceError console.log(err.message); //에러 메세지출력 alerttt is not defined try{ if(err.message.toString().length > 0){ throw 'throw error'; // 무조건 error (err2 catch를 보려고 사용함!) } }catch(err2){ console.log('err2: ',er..

JS/JS 수업분 2023.04.18

[JS] day08_과제 (전송받은 데이터 저장-출력)

HTML 삽입 미리보기할 수 없는 소스 DOCTYPE html> 연습문제 table{ font-size: 15px; } table td{ width:150px; } 데이터를 입력하세요 데이터 입력 칸 이름 : 거주지 : 좋아하는 리스트 리스트 1 : 리스트 2 : 리스트 3 : 이메일 : Pet 반려동물 여부 : 지금 가장 원하는 것 : 전송 전송받은 데이터 출력하기 출력 데이터 출력 테이블 이름 거주지 좋아하는 리스트 이메일 Pet반려동물여부 지금가장원하는것 // 객체 생성 let sbBtn = document.getElementById('sbBtn'); let printBtn = document.getElementById('printBtn'); // 버튼의 이름이 중복되면 안됨! const data ..

JS/JS 수업분 2023.04.18

[JS] day08_요일구하기

오늘은? Today " data-ke-type="html">HTML 삽입미리보기할 수 없는 소스    DOCTYPE html>html lang="en">head>    meta charset="UTF-8">    meta http-equiv="X-UA-Compatible" content="IE=edge">    meta name="viewport" content="width=device-width, initial-scale=1.0">    title>요일구하기title>head>body>    h1>오늘은?h1>    button type="button" onclick="today();">Todaybutton>    h3 id="print">            h..

JS/JS 수업분 2023.04.18