I have the data of the array object in a variable called hi[0].child.
hi[0].child = [
{code: "food", name: "buger"},
{code: "cloth", name: "outher"},
{code: "fruit", name: "apple"},
]
What I want to do is create a variable called hello, change the key value of hi[0].child, and put it in the hello variable.
For example, the key value of code is changed to value and name is changed to label. The values I want are as below.
expecter answer
hello = [
{label: "burger", value: "food"},
{label: "outher", value: "cloth"},
{label: "apple", value: "fruit"},
]
But when I use my code I get these errors.
Did not expect a type annotation here
so How can i fix my code?
this is my code
let hello = []
hi[0].child.map((v) => {
hello.push(label: v.name, value: v.code)
})