conan conan - 2 months ago 5x
jQuery Question

Trying to create an array based on this situation, jquery or javascript

I am trying to create a multidimensional array. something like following code, 44 and 45 is the key. When var pro is 44, I want to get 'onset, frequency' and then split them by .split(','). how should I write this array. Appreciate.

var pro = 44;
var global = [
44 : ["onset",'frequency'],
45 : ["onset"]


First of you have to convert your global array in object like below. And then you can get value for the keys.


please refer below snippet for more understanding.

var pro = 44;
var global = {"44":["onset","frequency"],"45":["onset"]};