Implement the function isKeyPresent
which checks if the object has a certain field
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 isKeyPresent = (obj, key) => {
return false;
}
solution.js
/**
* Implement the function isKeyPresent which checks if the object has a certain field
* */
import { isKeyPresent } from './helper.js';
const user = {
name: 'Tom',
age: '2',
isHappy: true,
createdAt: '2020-01-01'
}
console.log(isKeyPresent(user, 'name'));
console.log(isKeyPresent(user, 'address'));