Klucze obiektów JavaScript
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));
// expected output: Array ["a", "b", "c"]
Kaotik
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));
// expected output: Array ["a", "b", "c"]
window.addEventListener("keypress", function(event) {
if (event.code == 'key') {
// Do Stuff;
}
});
var buttons = {
foo: 'bar',
fiz: 'buz'
};
for ( var property in buttons ) {
console.log( property ); // Outputs: foo, fiz or fiz, foo
}
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));