Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. const myObject = {
  2.  
  3. [_selectedDay] :
  4. {
  5. toDo:'workout',
  6. selected: true,
  7. }
  8. }
  9.  
  10. //I expaned [0]
  11. (5) [{…}, {…}, {…}, {…}, {…}] "object"
  12. 0:
  13. ->2019-06-03: {toDo: "workout", selected: true}
  14. 1: {2019-06-04: {…}}
  15. 2: {2019-06-05: {…}}
  16. 3: {2019-06-06: {…}}
  17. 4: {2019-06-07: {…}}
  18.  
  19. myObject[0].toDo = 'workout'
  20.  
  21. var firstKey = Object.keys(myObject)[0];
  22. myObject[firstKey].todo = 'workout'
  23.  
  24. (5) [{…}, {…}, {…}, {…}, {…}] "object"
  25. 0:
  26. ->2019-06-03: {toDo: "workout", selected: true}
  27. 1: {2019-06-04: {…}}
  28. 2: {2019-06-05: {…}}
  29. 3: {2019-06-06: {…}}
  30. 4: {2019-06-07: {…}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement