0

I have the following data structure and I would like some help for the following question

let myObj = { a { a1 [ 1, 2, 3]}, b { b1 [ 4, 5, 6]}} 

also I have an array with two elements [a, b], how can I access my object property from values of array?

I tried for (let i = 0; i < array.length; i++) { console.log(myObj[array[i]] }

somehow I want to get the values from my a1 array but I do not know how to access them

chris09trt
  • 81
  • 4

0 Answers0