jscode 2-14~3-1

최정하·2024년 5월 10일

2-14

1. prompt.

-사용자에게 창을 띄워줌 -2개의 arguement를 받음. message,default

console.log(typeof age)

2. 타입변환

parseInt();

3. if 문

NaN:Not a number

console.log(isNaN(age))

isNaN: boolean으로 바꿔주는.

if (condition) {
}
else(condition) {
}

2-15~ 16

4. 기호

&& and
|| or
=== 같을 때
!== 같지 않을 때

else 꼭 사용하지 않아도 됨.

3-0

5. document

브라우저에 이미 있는 object
내가 접근할 수 있는 HTML
HTML에서 여러 정보를 가져올 수 있음
자바코드에서 그 항목들을 볼 수 있다.

document.title
document.body

3-1
const title = document.getElementById();

grab me

console.dir(title); < h1에서 가져올 수 있는 정보들을 보여줌.

title.innerText="Got you";

자바로html 안의 요소들 변경 가능.

console.log(title.className);
console.log(title.id);
console.log(title.innerText);
console.log(title.autofocus);

우리가 할 수 있는 것
1.document에서 항목들을 가지고 오는 것
2.변경하는 것

0개의 댓글