I have a one-dimensional array of integer in JavaScript that I\'d like to add data from comma separated string, Is there a simple way to do this?
e.g : var strVale
var strVale
Solution:
var answerInt = []; var answerString = "1,2,3,4"; answerString.split(',').forEach(function (item) { answerInt.push(parseInt(item)) });