• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 JavaScript, TS 게시판 $wrapper = null;을 해줘야 $wrapper 돔이 생성되는데요

$wrapper = null;을 해줘야 $wrapper 돔이 생성되는데요

5 글 보임 - 1 에서 5 까지 (총 5 중에서)
  • 글쓴이
  • #89889

    정중식
    참가자
    $wrapper = null;을 해줘야 $wrapper 돔이 생성되는데요 혹시 왜그런걸까요?
    
    
    class Clock {
        $wrapper =null;
        
      constructor({ $target }) {
        const $wrapper = document.createElement('section');
        $wrapper.className = 'Clock';
        $target.appendChild($wrapper);
        this.currentDate();
        this.render();
      }
      currentDate() {
        // 현재 시간 가져오기
        const currentTime = new Date();
        const currentHour = currentTime.getHours(); // 시간 (0부터 23까지)
        const currentMinute = currentTime.getMinutes(); // 분 (0부터 59까지)
        const currentSecond = currentTime.getSeconds(); // 초 (0부터 59까지)
        // 현재 날짜 가져오기
        const currentDate = currentTime.getDate(); // 일 (1부터 31까지)
        const currentMonth = currentTime.getMonth() + 1; // 월 (0부터 11까지. 0은 1월을 나타냄)
        const currentYear = currentTime.getFullYear(); // 연도 (예: 2023)
        // 출력 예시
        console.log(`현재 시간: ${currentHour}:${currentMinute}:${currentSecond}`);
        console.log(`현재 날짜: ${currentYear}-${currentMonth}-${currentDate}`);
      }
      render(){
      }
    }
    export default Clock;
     
    #89901

    codingapple
    키 마스터
    this.어쩌구 = 어쩌구 하거나 
    저 위치에 $wrapper = 어쩌구 해야 새로운 인스턴스에 추가될듯요
    #89941

    정중식
    참가자
    선생님 강의에서 this랑 class쪽 다시 봐야겠네요
    왜 그런건지 개념이 안잡히네요..
    혹시 선생님 찬스 가넝할까요? (절대 귀찮은건 아님)
    
     
    #89958

    codingapple
    키 마스터
    인스턴스에 변수하나 추가해주고 싶으면 class { 밑에 변수 = 어쩌구 하거나 constructor에 this.어쩌구 추가하면 됩니다
    #90002

    정중식
    참가자
    감사합니다
5 글 보임 - 1 에서 5 까지 (총 5 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠