By RichW

2010-11-22 11:23:32 8 Comments

I'm trying to access a property of an object using a dynamic name. Is this possible?

const something = { bar: "Foobar!" };
const foo = 'bar';; // The idea is to access, getting "Foobar!"

Related Questions

Sponsored Content

42 Answered Questions

[SOLVED] How do I remove a property from a JavaScript object?

63 Answered Questions

[SOLVED] How can I merge properties of two JavaScript objects dynamically?

68 Answered Questions

[SOLVED] What is the most efficient way to deep clone an object in JavaScript?

20 Answered Questions

[SOLVED] Checking if a key exists in a JavaScript object?

  • 2009-07-08 13:21:32
  • Adam Ernst
  • 1864195 View
  • 2815 Score
  • 20 Answer
  • Tags:   javascript object

44 Answered Questions

[SOLVED] Sort array of objects by string property value

42 Answered Questions

[SOLVED] Detecting an undefined object property

18 Answered Questions

[SOLVED] How to access the first property of an object in Javascript?

  • 2009-06-11 19:55:12
  • atogle
  • 429578 View
  • 572 Score
  • 18 Answer
  • Tags:   javascript object

28 Answered Questions

[SOLVED] Iterate through object properties

25 Answered Questions

[SOLVED] How does JavaScript .prototype work?

10 Answered Questions

[SOLVED] How to access the correct `this` inside a callback?

Sponsored Content