Created
June 26, 2018 03:57
-
-
Save prof3ssorSt3v3/b3779e85e74ecd8b2ba0dec1e7dd6ae6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************** | |
Object.keys(obj) | |
Object.values(obj) | |
Object.entries(obj) | |
Create an iterable object from the Object | |
**********************************/ | |
let westeros = { | |
cersei: 'Lannister', | |
arya: 'Stark', | |
jon: 'Snow', | |
brienne: 'Tarth', | |
daenerys: 'Targaryen', | |
theon: 'Greyjoy', | |
jorah: 'Mormont', | |
margaery: 'Tyrell', | |
sandor: 'Clegane', | |
samwell: 'Tarly', | |
ramsay: 'Bolton' | |
} | |
//for(let prop of arr) | |
// foreach( ) filter( ) map() reduce() | |
let keys = Object.keys(westeros); | |
//console.log('Keys ', keys); | |
let vals = Object.values(westeros); | |
//console.log('Vals', vals); | |
let entries = Object.entries(westeros); | |
console.log('Entries', entries); | |
console.log( entries[2][1] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment