encender las propiedades de un objeto en TS
Object.keys(obj).forEach(e => console.log(`key=${e} value=${obj[e]}`));
Unusual Unicorn
Object.keys(obj).forEach(e => console.log(`key=${e} value=${obj[e]}`));
var myObj = {foo: "bar", baz: "baz"};
Object.values(myObj).map((val) => {
console.log(val);
})
// "bar" "baz"
const object = {a: 1, b: 2, c: 3};
for (const property in object) {
console.log(`${property}: ${object[property]}`);
}
var person={
first_name:"johnny",
last_name: "johnson",
phone:"703-3424-1111"
};
for (var property in person) {
console.log(property,":",person[property]);
}
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
// do stuff
}
}