据我知道jQuery有一个功能inArrary
其是应用类似以下java脚本或jQuery有一个像inArraykey的功能吗?
$.inArray(value, array); it return -1 if not in array
然而,这种功能仅适用于值,是不适合于多维阵列
eg . fruit [ apple,orange]
例如,如果我有这样的阵列
eg. fruit [apple => [red,$1], orange => [orange,$5]]
我必须检查一个值是否存在(例如香蕉)作为数组关键,在这种情况下是否有适合的功能?
你的问题/例子不是很清楚。你指的是indexOf()吗? – mika