0

Is there's a way to insert a dynamic value between dots of .map?

const DYNAMIC = red;

for example cars.color.DYNAMIC.map(car=> car)?

Thanks!

rSeeker
  • 161
  • 10
  • 1
  • Whaaat, I thought I need to a period before []. Thank you so much!!!! – rSeeker Jul 18 '22 at 07:15
  • Usually, we access the values of a JavaScript object using dot notation. But, if we need to access values using a dynamic key (key is a variable), then the dot notation cannot be used to access the value held by the key. We need bracket notation in this scenario. Hope this explanation would help :) – code99 Jul 18 '22 at 07:26

0 Answers0