How does js know the array variable name to get the array element?

I have two arrays in data
data: {

array = [],
text = [],
}

now I need to load the array
var type = "array";// or" text"
data.type [index] .key
so that I can report an error. How can I get it?
Thank you

May.01,2022

data[type][index].key

data[key]

if the key is a variable, you need to use square brackets. The point is not applicable


datatype.key. First of all, you need to understand that getting the elements in the array is obtained through the index. Then you have two attributes in the data object, but the array, so you first datatype.key

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3f9c2-2c4d5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3f9c2-2c4d5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?