44
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Chromeのコンソールにテーブルを表示する

Last updated at Posted at 2013-07-11

サンプル1

var data = [[1,2], [3,4]];
console.table(data);

sample1.png

サンプル2

var data = {data1:[1,2], data2:[3,4]};
console.table(data);

sample2.png

サンプル3

function Add(name, price){
    this.name = name;
    this.price = price;
}

var data = {};
data[0] = new Add("すごいテレビ", 100);
data[1] = new Add("伝説の雑誌", 200);
data.test = new Add("テスト", 9999);    

console.table(data);

image1.jpeg

console.table未対応ブラウザを考慮する場合

if (void 0 !== window.console && void 0 !== console.table) {
    // 対応していた場合のコードをここ書く
} else {
    alert("このブラウザはconsole.tableに未対応です");
}
44
45
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
44
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?