Dapatkan semua properti objek di JavaScript
Object.keys(data).forEach(function (key, index) {
var value = data[key];
console.log(key,index, value);
});
Purple Team
Object.keys(data).forEach(function (key, index) {
var value = data[key];
console.log(key,index, value);
});
const user = {
name: 'Alex',
age: 30
};
const props = Object.keys(user);
console.log(props); // [ 'name', 'age' ]
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1));
// expected output: Array ["a", "b", "c"]