Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Using for…in To Loop Over an Object in JavaScript

const person = {
    first_name: 'Monica',
    last_name: 'Geller',
    phone: '915-996-9739',
    email: 'monica37@gmail.com',
    street: '495 Grove Street',
    city: 'New York',
    country: 'USA',
};

for (const key in person) {
    console.log(`${key} => ${person[key]}`);
}
Source by www.webmound.com #
 
PREVIOUS NEXT
Tagged: #Using #To #Loop #Over #Object #JavaScript
ADD COMMENT
Topic
Name
7+2 =