Last active
December 28, 2019 15:47
-
-
Save keevitaja/127dc38f01b7e856ffa2f60ad47ea0a3 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
const print = obj => { | |
for (const key in obj) { | |
console.log(obj[key]) | |
} | |
} | |
const num = {} | |
num[5] = 5 | |
num[2] = 2 | |
num[7] = 7 | |
num[1] = 1 | |
print(num) | |
console.log('\n\n') | |
const str = {} | |
str['h'] = 'h' | |
str['b'] = 'b' | |
str['z'] = 'z' | |
str['a'] = 'a' | |
print(str) | |
// outputs: | |
// | |
// 1 | |
// 2 | |
// 5 | |
// 7 | |
// | |
// h | |
// b | |
// z | |
// a | |
// | |
// is this behevior guaranteed? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment