How to convert comma separated string into numeric array in javascript

后端 未结 9 1761
粉色の甜心
粉色の甜心 2021-02-05 02:06

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

9条回答
  •  温柔的废话
    2021-02-05 03:04

    The split() method is used to split a string into an array of substrings, and returns the new array.

    Syntax:
      string.split(separator,limit)
    
    
    arr =  strVale.split(',');
    

    SEE HERE

提交回复
热议问题