How to split a comma separated string and process in a loop using JavaScript

前端 未结 5 2073
生来不讨喜
生来不讨喜 2020-12-08 00:05

How to split a comma separated string and process in a loop using JavaScript?

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 00:49

    Try the following snippet:

    var mystring = 'this,is,an,example';
    var splits = mystring.split(",");
    alert(splits[0]); // output: this
    

提交回复
热议问题