강의

멘토링

커뮤니티

Inflearn Community Q&A

yjlee4626111820's profile image
yjlee4626111820

asked

Learning JavaScript by Focusing on the Essentials

Remove default event

.forms[0]

Resolved

Written on

·

87

0

document.forms에서 [0]은 뒤에 왜 붙는 건가요???

javascript

Answer 1

0

sucoding님의 프로필 이미지
sucoding
Instructor

안녕하세요.

document.forms은 화면에 있는 모든 <form> 태그를 찾습니다.

즉, document.forms의 결과는 배열(유사배열) 형태입니다.

document.forms[0]은 화면에 form 태그가 여러 개 있더라도 가장 먼저 발견된 form 태그를 선택하겠다는 의미입니다.

이해되셨을까요?

추가적인 설명이 필요하면 다시 질문해주세요 😄

yjlee4626111820's profile image
yjlee4626111820

asked

Ask a question