0
0

配列やオブジェクトはconsole.table()で見ると分かりやすい

Last updated at Posted at 2024-02-15

コード

  • 以下の変数menuListは7個のオブジェクトを持った配列
const menuList = [
  {
    name: "チーズバーガー",
    price: 500,
    category: "food",
  },
  {
    name: "てりやきバーガー",
    price: 550,
    category: "food",
  },
  {
    name: "月見バーガー",
    price: 600,
    category: "food",
  },
  {
    name: "ベーコンレタスバーガー",
    price: 550,
    category: "food",
  },
  {
    name: "コーヒー",
    price: 200,
    category: "drink",
  },
  {
    name: "オレンジジュース",
    price: 250,
    category: "drink",
  },
  {
    name: "コーラ",
    price: 180,
    category: "drink",
  },
];

console.table(menuList);

スクリーンショット 2024-01-05 21.10.28.png

最初(0番目)のオブジェクトだけ抜き出してみる

console.table(menuList[0]);

スクリーンショット 2024-01-05 21.10.35.png

0
0
0

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
0
0