0

Basically I want to use an object to hold certain dates. For example:

var date {
  jan26: 'Today this happened'
};

Then get the current date and put it into a string. For example: var today = 'jan26';. Then use that to refer to the object property: For example: alert(date.today); Is there any way to do this?

Matthew Herbst
  • 29,477
  • 23
  • 85
  • 128
Jason
  • 5
  • 2
  • Which part are you exactly needing help with? – Michael Ramos Jan 27 '16 at 04:28
  • Possible duplicate of [JavaScript property access: dot notation vs. brackets?](http://stackoverflow.com/questions/4968406/javascript-property-access-dot-notation-vs-brackets) – Phil Jan 27 '16 at 04:30

1 Answers1

2

Use following code: date[today]

leo.fcx
  • 6,137
  • 2
  • 21
  • 37