Konsol tablosu()
Örnek
Konsolda tablo olarak bir dizi yazın:
console.table(["Audi", "Volvo", "Ford"]);
Konsolda tablo olarak bir nesne yazın:
console.table({firstname:"John", lastname:"Doe"});
Aşağıda daha fazla örnek.
Tanım ve Kullanım
Yöntem table()
, konsola bir tablo yazar.
Not
Sütun adlarına tıklayarak tabloyu sıralayabilirsiniz.
Sözdizimi
console.table(tabledata, tablecolumns)
parametreler
Parameter | Description |
tabledata | Required. The data to fill the table with. |
tablecolumns | Optional. An array with the names of the table columns. |
Daha fazla örnek
Bir dizi nesne kullanma:
const car1 = {name:"Audi", model:"A4"}
const car2 = {name:"Volvo", model:"XC90"}
const car3 = {name:"Ford", model:"Fusion"}
console.table([car1, car2, car3]);
Tabloya yalnızca "model" sütununu ekleyin:
const car1 = {name:"Audi", model:"A4"}
const car2 = {name:"Volvo", model:"XC90"}
const car3 = {name:"Ford", model:"Fusion"}
console.table([car1, car2, car3], ["model"]);
Tarayıcı Desteği
console.table()
tüm modern tarayıcılarda desteklenir:
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
console.table()
Internet Explorer 11'de (veya önceki sürümlerde) desteklenmez.