create an associative array in jquery

前端 未结 5 1802
迷失自我
迷失自我 2021-01-01 23:43

This is what I have so far and the shoe types are boots, wellingtons, leather, trainers (in that order)

I want to iterate through and assign th

5条回答
  •  我在风中等你
    2021-01-02 00:16

    Associative array in javascript is the same as object

    Example:

    var a = {};
    a["name"] = 12;
    a["description"] = "description parameter";
    console.log(a); // Object {name: 12, description: "description parameter"}
    
    var b = [];
    b["name"] = 12;
    b["description"] = "description parameter";
    console.log(b); // [name: 12, description: "description parameter"]
    

提交回复
热议问题