2017  Kodetalk | Feedback | Privacy Policy | Terms | About

how to split a string in javascript and store in array

what is the best way to split a string using javascript and store in an array:

var str = "string,need,to,split";


To split and store :

var res = str.split(",");

This will split with comma and store in a variable.

Answer is