function myHash(list) {
var result = {};
for (var i = 0; i < list.length; i++) {
result[list[i][0]] = list[i][1];
}
return result;
}
console.log(myHash([['foo', 'bar'], ['baz', 42], [true, false]]));var list = [['foo', 'bar'], ['baz', 42], [true, false]];
var result = list.reduce(function (obj, item) {
obj[item[0]] = item[1];
return obj;
}, {});
console.log(result); var n=prompt();
if(Number.isNaN(Number(n)))
alert('Это строка'); var x = 100;
function move(param) {
return function(){
alert("hello" + param)
}
}
move(x)(); Object.getOwnPropertyNames(foo).forEach(function(prop) {
Object.defineProperty(
bar,
prop,
Object.getOwnPropertyDescriptor(foo, prop)
);
});
<audio autoplay controls src="http://stream-dc1.radioparadise.com/ogg-96m">Со своим адресом, естественно.