I am working with an array of objects that contains value pairs. I am trying to access a specific value using the following syntax:
myArray.code
or
myArray[0].code
However, I am receiving an error message stating that myArray does not contain a property named code. When I check the array in the console, each object has two items in it - code and name. I would like to access code and name individually, but I am unsure how to achieve this.
(2) [{…}, {…}]
0: {code: "PROG2700", name: "Client Side Programming"}
1: {code: "PROG1400", name: "jk"}
length: 2
This is the initial array holding these objects:
let [state_array_items, setState_array_items] = React.useState<Object[]>([]);