콘솔 테이블()
예시
콘솔에서 배열을 테이블로 작성:
console.table(["Audi", "Volvo", "Ford"]);
콘솔에서 객체를 테이블로 작성합니다.
console.table({firstname:"John", lastname:"Doe"});
아래에 더 많은 예가 있습니다.
정의 및 사용
이 table()
메서드는 콘솔에 테이블을 씁니다.
메모
열 이름을 클릭하여 테이블을 정렬할 수 있습니다.
통사론
console.table(tabledata, tablecolumns)
매개변수
Parameter | Description |
tabledata | Required. The data to fill the table with. |
tablecolumns | Optional. An array with the names of the table columns. |
더 많은 예
객체 배열 사용:
const car1 = {name:"Audi", model:"A4"}
const car2 = {name:"Volvo", model:"XC90"}
const car3 = {name:"Ford", model:"Fusion"}
console.table([car1, car2, car3]);
테이블에 "모델" 열만 포함합니다.
const car1 = {name:"Audi", model:"A4"}
const car2 = {name:"Volvo", model:"XC90"}
const car3 = {name:"Ford", model:"Fusion"}
console.table([car1, car2, car3], ["model"]);
브라우저 지원
console.table()
모든 최신 브라우저에서 지원됩니다.
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
console.table()
Internet Explorer 11(또는 이전)에서는 지원되지 않습니다.