Implement the function getObjectKeys
.
It should return an array of strings that represent all keys of the object
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
helper.js
export const getObjectKeys = (obj) => {
return [];
}
solution.js
/**
* Implement the function getObjectKeys.
*
* It should print all keys of the object to the console
* */
import { getObjectKeys } from './helper.js';
const user = {
name: 'Tom',
age: '2',
isHappy: true,
createdAt: '2020-01-01'
}
const parrot = {
type: 'bird',
lifespan: '2'
}
console.log(`The object user has following keys: ${getObjectKeys(user)}`);
console.log(`The object parrot has following keys: ${getObjectKeys(parrot)}`);