www.w3schools.com/jsref/obj_console.asp
Console Object
The Console Object Console Object The Console object provides access to the browser's debugging console. Console Object Methods Method Description assert() Writes an error message to the console if the assertion is false clear() Clears the console count()
www.w3schools.com
자주 쓰이는 console 명령어 몇가지를 익혀보려 합니다.
console.log('야!');
로그에 원하는 값을 찍어줍니다.
오브젝트 값을 보여줍니다.
console.log와의 차이는 아래와 같습니다.
타이머를 실행하고 종료하며, 얼만큼의 시간이 걸렸는지 알게 해줍니다.
console.time('duration');
let count = 0;
for (let i = 0; i < 50000; i++) {
count ++;
};
console.timeEnd('duration');
//result:
duration: 3.241ms
에러 메세지를 출력합니다.
경고 메세지를 출력합니다.
Int의 1000 단위마다 ',' 찍어주는 코드 (0) | 2020.11.04 |
---|---|
callback 함수 활용하기 / 자바스크립트 (0) | 2020.09.16 |
async, await 사용 연습 / 자바스크립트 (0) | 2020.07.15 |
Promise 이해하기 2 (0) | 2020.07.14 |
Promise 이해하기 (0) | 2020.07.10 |
댓글 영역