Skip to content

Instantly share code, notes, and snippets.

@Octagon-simon
Created June 15, 2022 12:51
Show Gist options
  • Select an option

  • Save Octagon-simon/defc693d9832896a1ba2455c436f6418 to your computer and use it in GitHub Desktop.

Select an option

Save Octagon-simon/defc693d9832896a1ba2455c436f6418 to your computer and use it in GitHub Desktop.
const profile = {
name : "Simon",
email: "me@you.com",
gender : "male"
}
let i = 0;
//get the length of the object
while( i < Object.keys(profile).length ){
//since we hold the current index, retrieve the key and value assigned to it
console.log( Object.keys(profile)[i]+' = '+Object.values(profile)[i] );
i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment