1. 교재 예제
    1. ex7-01.html
    2. ex7-02.html
    3. ex7-03.html
    4. ex7-04.html
    5. ex7-05.html
    6. ex7-06.html
    7. ex7-07.html
    8. ex7-08.html
    9. ex7-09.html
    10. ex7-10.html
    11. ex7-11.html
  2. 자바스크립트 객체 구성
    1. 프로퍼티(property)와 메소드(method)로 구성
      1. property : 속성(변수)
      2. method : 함수
    2. 객체 유형
      1. 코어 객체
      2. HTML DOM 객체
      3. 브라우저 객체
  3. 코어 객체
    1. 종류 : Array, Date, String, Math 등
      1. 생성 : let today = new Date();
      2. 사용 : document.write(today.toLocaleString());
    2. 배열
      1. 생성 : let cities = [“seoul”, “jeonju”, “gwangju”];   let a = new Array(5);
      2. 사용 : document.write(cities[1]);   document.write(cities.length);
      3. 함수 : a.concat(cities);  a.join(“-“);  a.slice(2,4);   a.sort();   a.reverse();   a.toString();
    3. Date 객체
      1. 생성 : let today = new Date();  let birth = new Data(2003, 5, 7); #2003년 6월 7일 (5->6번째 달)
      2. 사용 : let h = today.getHours(); .getFullYear(), .getMonth(), .getDate(), .Minutes(), .getSeconds(), .getMiliseconds(),  .toLocaleString()
    4. String 객체
      1. 생성 : let h = new String(“Hello”);  let h = “Hello”;
      2. 사용 : h.concat(“Java”);  .length,  .charAt(0),  .indexOf(“e”),  .slice(2,4), .substr(2,4),  .toUpperCase(),  .toLowerCase(),  .replace(“l”, “r”),  .trim()
    5. Math 객체
      1. 생성하지 않고 바로 사용
      2. 사용 : let sq = Math.sqrt(4);,  Math.PI,  Math.random(),  Math.floor(3.14),
    6. 사용자 정의 객체 만들기 1 : new Object()로 만들기
      1. 객체 정의
        1. function inquiry() { return this.balance; }
        2. function deposit(money) { this.balance += money; }
        3. let account = new Object();
        4. account.owner = “홍길동”;
        5. account.balance = 35000;
        6. account.inquiry = inquiry;
        7. account.deposit = deposit;
      2. 객체 사용
        1. account.deposit(10000);
        2. account.withdraw(5000);
    7. 사용자 정의 객체 만들기 2 : 리터럴 표기법으로 만들기
      1. let account = {
        owner = “홍길동”;
        balance = 35000;
        inquiry = function(){ return this.balance; }
        deposit = function(money){ this.balance += money; }
        }
    8. 사용자 정의 객체 만들기 3 : 객체의 틀(프로토타입)을 만들고 객체 생성하기

       
error: Content is protected !!