Created
April 13, 2024 02:23
-
-
Save madhoshyagnik/383a04e1e1939d8b0a9c7a54ba6b17a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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