100 JS Interview Questions - #10: Add properties to an empty object

preview_player
Показать описание
Assuming d is an “empty” object in scope, say:

var d = {};
…what is accomplished using the following code?

[ 'zebra', 'horse' ].forEach(function(k) {
d[k] = undefined;
});
Рекомендации по теме
visit shbcf.ru