Advertisement
Guest User

Untitled

a guest
Feb 24th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. const user = {
  2. name: "Agboola Jude",
  3. password: "*****",
  4. [Symbol.iterator]: function () {
  5. const o = this;
  6. let idx = 0;
  7. const keys = Object.keys(o);
  8. return {
  9. next: function () {
  10. return{
  11. value: o[keys[idx++]],
  12. done : (idx > keys.length)
  13. }
  14. }
  15. }
  16. }
  17. }
  18.  
  19. //for-of now works!!
  20. for(const value of user) console.log(value)
  21. //"Agboola Jude"
  22. //"*****"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement