I got the following string from a Json:
image/folder/folder/xxx.jpg
I would like to explode the xxx.jpg and keep it to local var.
thanks
I got the following string from a Json:
image/folder/folder/xxx.jpg
I would like to explode the xxx.jpg and keep it to local var.
thanks
Split it using String#split
method and get the last value from the array using Array#pop
method.
var string = " image/folder/folder/xxx.jpg";
var res = string.split('/').pop();
console.log(res);