[TIL] [JS] 09.08 `console.log` 똑똑하게 쓰는 방법

tmaxos.ux.sinri·2022년 9월 8일
0

[TIL]

목록 보기
2/2
post-thumbnail

자료 원본 링크 : It’s 2022, Please Don’t Just Use “console.log” Anymore

1. 찍을게 많을 때는 객체로 찍으면 보기 편하다.

const name = 'sinri';
const age = 20;
const company = 'tmaxos';

console.log({name, age, company});

2. warn error 이용하기

error의 경우 함수 콜스택도 보여주기 때문에 디버깅에 용이

3. 객체 배열일 경우table 이용하기

const arrAlcohols = [
  {
    name: "jameson",
    price: "expensive",
    key: 0,
  },{
    name: "Tanqurey",
    price: "normal",
    key: 1,
  },{
    name: "BulletRye",
    price: "expensive",
    key: 2,
  }
];

console.table(arrAlcohols);


짱이당

profile
티맥스오에스 UX팀 sinri

0개의 댓글