Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for JavaScript set object key by variable [duplicate]

Current License: CC BY-SA 4.0

Post Revisions

34 events
when toggle format what by license comment
May 23, 2024 at 13:47 history closed user229044 javascript Users with the javascript badge or a synonym can single-handedly close questions as duplicates and reopen them as needed. Duplicate of Accessing an object property with a dynamically-computed name
Sep 18, 2023 at 23:28 answer added Akaisteph7 timeline score: 4
Mar 7, 2023 at 22:07 history protected Community Bot
Feb 3, 2023 at 19:35 answer added underflow timeline score: 29
Jan 3, 2023 at 10:26 answer added Rahul Pawar timeline score: 19
Nov 17, 2022 at 15:00 answer added Surendra Singh Kamboj timeline score: 0
Nov 2, 2022 at 2:38 answer added jbz timeline score: 0
Sep 1, 2022 at 8:12 review Close votes
Sep 5, 2022 at 0:06
Sep 1, 2022 at 7:52 comment added outis Does this answer your question? How to use a variable for a key in a JavaScript object literal?
Jul 25, 2022 at 19:37 answer added user14389165 timeline score: 14
Apr 14, 2022 at 8:59 answer added devtunus timeline score: 10
Apr 12, 2022 at 18:22 history reopened Amir Makram
Spomky-Labs
Lajos Arpad
Apr 11, 2022 at 11:52 review Reopen votes
Apr 12, 2022 at 18:22
Apr 2, 2022 at 9:32 comment added Brice C. In my case, Dan Cron's tip was fastest to correct my code. As to what Keith says, I definitely agree. As to what @Hunter McMillen said about IE11, I am wondering more generally: Is it reasonable to take into account Microsoft browsers now, since their world market share amounts to peanuts nowadays? Just as Firefox (my favourite one), they are bound to die presently, including Opera. Quoting Keith: ' let's move on'.
Oct 8, 2018 at 10:10 history edited t.niese CC BY-SA 4.0
deleted 269 characters in body
Oct 8, 2018 at 10:08 history duplicates list edited t.niese duplicates list edited from How to use a variable for a key in a JavaScript object literal? to How to use a variable for a key in a JavaScript object literal?, How do I create a dynamic key to be added to a JavaScript object variable [duplicate]
Mar 21, 2018 at 12:58 comment added Keith @Jake Like Hunter says, it's best not to code for ES5 users. If you need to support older browsers, pollyfill & transpile. It's now 2018, not 2009, we really need to move on.
Oct 2, 2017 at 15:38 comment added Hunter McMillen @Jake That is exactly what babel is for. As Dan Cron mentions above.
Sep 30, 2017 at 1:47 comment added Jake @HunterMcMillen You can't normally assume everyone is using the latest version of whatever browser - a significant number of web users have a significantly out of date browser. Your use of ES6-specific constructs will break your site for them.
Sep 29, 2017 at 13:16 comment added Dan Cron @Jake That's a good point. One possible solution is to use babel to transpile ES6 into ES5.
Sep 28, 2017 at 13:47 comment added Hunter McMillen @Jake The only browser that currently does not support this es6 feature is IE11: kangax.github.io/compat-table/es6/…
Sep 28, 2017 at 7:09 comment added Jake @DanCron Sounds great, but when will 99%+ of 'browsers' in the user base be ES6-capable?
May 23, 2017 at 12:34 history edited URL Rewriter Bot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Apr 29, 2016 at 20:40 comment added Dan Cron The solution in ES6 is to put the variable in square brackets in order to evaluate it. var key = "happyCount"; myArray.push({ [key]: someValueArray });
Nov 18, 2014 at 5:44 history closed Bergi javascript Users with the javascript badge or a synonym can single-handedly close questions as duplicates and reopen them as needed. Duplicate of How to use a variable for a key in a JavaScript object literal?
Nov 18, 2014 at 5:44 history reopened Bergi javascript Users with the javascript badge or a synonym can single-handedly close questions as duplicates and reopen them as needed.
Jun 29, 2014 at 18:28 review Reopen votes
Jun 29, 2014 at 19:01
S Jul 17, 2012 at 7:32 history edited Community Bot
insert duplicate link
S Jul 17, 2012 at 7:32 history closed Esailija
Zirak
Community Bot
j0k
exact duplicate
Jul 16, 2012 at 16:58 vote accept Hunter McMillen
Jul 16, 2012 at 16:29 answer added kiranvj timeline score: 631
Jul 16, 2012 at 16:27 review Close votes
Jul 17, 2012 at 7:47
Jul 16, 2012 at 16:26 answer added gen_Eric timeline score: 3085
Jul 16, 2012 at 16:24 history asked Hunter McMillen CC BY-SA 3.0
toggle format

AltStyle によって変換されたページ (->オリジナル) /