get keys of object js

JavaScript
let person = {
  firstname: 'John',
  lastname: 'Doe'
}

console.log(person.firstname);
// expected output: "John"

delete person.firstname;

console.log(person.firstname);
// expected output: undefinedmyObject = {
	"key": "value"
}

Object.keys(myObject); // get array of keysvar buttons = {
  foo: 'bar',
  fiz: 'buz'
};

for ( var property in buttons ) {
  console.log( property ); // Outputs: foo, fiz or fiz, foo
}
Source

Also in JavaScript: