Split a string using jquery

  • 0

Let string be:
var str=”hello/how/are/u?”;

Split string by “/”.

var res = str.split(“/”);

//getting complete result.
alert(res);
// getting each value in the array
alert(res[0]);
alert(res[1]);

Let string be: var str=”hello/how/are/u?”; Split string by “/”. var res = str.split(“/”); //getting complete result. alert(res); // getting each value in the array alert(res[0]); alert(res[1]);

Let string be: var str=”hello/how/are/u?”; Split string by “/”. var res = str.split(“/”); //getting complete result. alert(res); // getting each value in the array alert(res[0]); alert(res[1]);