Last active
January 15, 2020 07:27
-
-
Save behnamazimi/0da04e8c45f7938e260718e5957caa2b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let user = { username: "bhnmzm", first_name: 'Behnam', last_name: "Azimi", title: "Front-End Developer" }; | |
user[Symbol.iterator] = function*() { | |
for (let key in this) { | |
yield [key, this[key]]; | |
} | |
}; | |
for (let [key, value] of user) { | |
console.log(key + ": ", value) | |
} | |
//o: username: bhnmzm | |
//o: first_name: Behnam | |
//o: last_name: Azimi | |
//o: title: Front-End Developer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment