Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Object.keys() Method to Loop Through 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',
};

const keys = Object.keys(person);

console.log(keys);
// ['first_name', 'last_name', 'phone', 'email', 'street', 'city', 'country'];
Source by www.webmound.com #
 
PREVIOUS NEXT
Tagged: #Method #Loop #Through #Object #JavaScript
ADD COMMENT
Topic
Name
2+2 =