1분 퀴즈

    4. HTML 문서에 img 태그를 추가하려고 합니다. 이때, 이미지 경로는 ‘sample.jpg’, 이미지 설명은 ‘샘플 이미지’라고 지정하려고 할 때, 다음 코드의 A, B, C, D에 들어 갈 내용으로 알맞은 것을 고르세요.

    <script>
      const img = document.(A);
      img.(B) = "sample.jpg";
      img.(C) = "샘플 이미지";
      document.body.(D)(img);
    </script>

    (A) - (B) - (C) - (D)

    createAttribute('img') - al - src - createTextNode

    createAttribute('img') - src - al - setAttributeNode

    createElement('img') - al - src - append

    createElement('img') - src - al - appendChild

    createTextNode('img') - al - src - removeChild

    정답확인

    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.