📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
First way: ForEach method
function demo(){
let users = [
{
firstName: "Ramesh",
lastName: "Fadatare",
emailId : "ramesh@gmail.com"
},
{
firstName: "Tony",
lastName: "Stark",
emailId : "tony@gmail.com"
},
{
firstName: "Tom",
lastName: "Cruise",
emailId : "tom@gmail.com"
}
]
users.forEach((user)=> {
console.log(user.firstName)
console.log(user.lastName)
console.log(user.emailId)
});
}
demo();
Ramesh
Fadatare
ramesh@gmail.com
Tony
Stark
tony@gmail.com
Tom
Cruise
tom@gmail.com
Second way: For of loop
function demo1(){
let users = [
{
firstName: "Ramesh",
lastName: "Fadatare",
emailId : "ramesh@gmail.com"
},
{
firstName: "Tony",
lastName: "Stark",
emailId : "tony@gmail.com"
},
{
firstName: "Tom",
lastName: "Cruise",
emailId : "tom@gmail.com"
}
]
for(let user of users){
console.log(user.firstName)
console.log(user.lastName)
console.log(user.emailId)
}
}
demo1();
Ramesh
Fadatare
ramesh@gmail.com
Tony
Stark
tony@gmail.com
Tom
Cruise
tom@gmail.com
Related JavaScript Examples
- How to Empty an Array in JavaScript //Popular
- JavaScript Utility Methods //Popular
- Best JavaScript Utility Libraries //Popular
- Check if Map is Null or Empty in Java //Popular
Comments
Post a Comment
Leave Comment