how to return all keys of an obkject code example
Example 1: Return the Objects Keys and Values
const keysAndValues = (obj) => [Object.keys(obj), Object.values(obj)];
keysAndValues({a: 1, b: 2, c: 3});
//➞ [["a", "b", "c"], [1, 2, 3]]
keysAndValues({a: "Dell", b: "Microsoft", c: "Google"}));
//➞ [["a", "b", "c"], ["Dell", "Microsoft", "Google"]]
keysAndValues({key1: true, key2: false, key3: undefined});
// ➞ [["key1", "key2", "key3"], [true, false, undefined]]
Example 2: get all keys from pbject javascirpt
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.keys(object1)); // expected output: Array ["a", "b", "c"]
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys