Day-22 DOM getElementById() Method

So Eun Ahn·2021년 2월 3일
0

JavaScript

목록 보기
25/26

getElementById()

DOM getElementById() Method returns the element that has the ID attribute with the specified value.

Normally faster then using querySelector()

const btnHold = document.querySelector('.btn--hold');
const current0El = document.getElementById('current--0');

Recap

const dice = Math.trunc(Math.random() * 6) + 1;
  console.log(dice);

Math.trunc()

주어진 값의 소수부분을 제외한 숫자의 정수부분만 return한다.

profile
오늘도 새로운 도전을 한다

0개의 댓글