📜  节点 js 中的散列 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:08.135000             🧑  作者: Mango

代码示例3
var h = new Object(); // or just {}
h['one'] = 1;
h['two'] = 2;
h['three'] = 3;

// show the values stored
for (var k in h) {
    // use hasOwnProperty to filter out keys from the Object.prototype
    if (h.hasOwnProperty(k)) {
        alert('key is: ' + k + ', value is: ' + h[k]);
    }
}