Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript loop through object

const point = {
	x: 10,
 	y: 20,
};

for (const [axis, value] of Object.entries(point)) {
	console.log(`${axis} => ${value}`);
}

/** prints:
 * x => 10
 * y => 20
 */
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #javascript #loop #object
ADD COMMENT
Topic
Name
1+2 =