my json is:
export const wordTrans_ar = [
{
"english_word": "window",
"hebrew": "חלון",
},
{
"english_word": "good",
"hebrew": "טוב",
}
[
i want my function (in react) to return only the 1st item (the english_word) of the 1st sell in my json array.
i traied : a_arr.english_word[0]
but it didn’t work. why?
how do i write it?
2
Answers
you have to access the index of your array first, before you want to get the english_word property.
In your example, that would be:
wordTrans_ar[0].english_word
Can you try
You have to trace the object structure when accessing items.