LoginSignup
1
0

Javascript 配列・連想配列

Last updated at Posted at 2024-03-16

Javascript の勉強した内容のメモ書きをしていく

配列の場合、インデックス番号指定でデータを取得する。

配列
const dog = [
    '秋田犬',
    'ポメラニアン',
];

console.log(dog[1]);

連想配列の場合、メンバー毎にドット(.)で区切り、欲しいデータを取得する。

連想配列
const dog = {
    '秋田犬':{
        'color':'茶色',
        'size':'big'
    },
    'ポメラニアン':{
        'color':'茶色',
        'size':'mini'
    }
};

console.log(dog.ポメラニアン.size);   
1
0
3

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