Skip to content

Instantly share code, notes, and snippets.

@madhoshyagnik
Created April 13, 2024 02:23
Show Gist options
  • Save madhoshyagnik/383a04e1e1939d8b0a9c7a54ba6b17a2 to your computer and use it in GitHub Desktop.
Save madhoshyagnik/383a04e1e1939d8b0a9c7a54ba6b17a2 to your computer and use it in GitHub Desktop.
let user = {
name: 'crystel',
age: 30,
email: 'crystel@gmail.com',
location: 'berlin',
blogs: [
{ title: 'why mac and cheese rules', likes: 30},
{ title: '10 things to make with marmite', likes: 40},
],
login(){
console.log('user logged in');
},
logout(){
console.log('the user is logged out')
},
logBlogs(){
console.log('this user has written following blogs');
this.blogs.forEach(blog => {
console.log(`title is ${blog.title} and the number of likes are ${blog.likes}`);
})
}
};
user.logBlogs();
user.login();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment