Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const user = {
- name: "Agboola Jude",
- password: "*****",
- [Symbol.iterator]: function () {
- const o = this;
- let idx = 0;
- const keys = Object.keys(o);
- return {
- next: function () {
- return{
- value: o[keys[idx++]],
- done : (idx > keys.length)
- }
- }
- }
- }
- }
- //for-of now works!!
- for(const value of user) console.log(value)
- //"Agboola Jude"
- //"*****"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement