Reputation: 411
I am facing a bit weird problem while splitting out a string in jQuery. For some reason I am getting following exception
TypeError: Object [object Array] has no method 'split'
i have attached one image that displays the data n exception on browser. n
Code Snippet:
**skill List contains [Array[4], Array[4], Array[4], Array[4],
Array[4], Array[4], Array[4], Array[4], Array[4], Array[4], Array[4]] and every array has following structure** 0: Array[4] 0: "NWDS" 1: "NWDS " 2: 1 3: 1 length: 4**
$.each(skillsList, function(index, item) {
var array = skillsList[index].split(',');
});
Upvotes: 0
Views: 157
Reputation: 4810
skillList[index]
is an Array[4]
. Arrays do not have the split
function and therefore you're getting an error. You'll have to access one of the indeces of skillList[index]
(eg skillList[index][innerIndex]
in order to reach a String
.
Upvotes: 3