I want to split the following string into 2 arrays.
First array from the beginning to '/' and the second from '/' to end.
Also, I've tryied with replace to remove the '/' but returns error.
var str = 'word1-word2/word3+word4'.replace(/\+|/|-/g,' ');
http://jsbin.com/kubezabemu/1/edit?js,console
The wanted output should be like:
var arr1 = ['word1', 'word2'];
var arr2 = ['word3', 'word4'];
this way you get an array that contains unlimited of your expected arrays
var arr = 'word1-word2/word3+word4'.split("/");
var res = [];
for(var i = 0; i < arr.length; i++){
str=arr[i].replace(/\+|-/g,' ');
res.push( str.split(" "));
}
console.log(res)
console output
[["word1", "word2"], ["word3", "word4"]]
I am storing an array of objects in localStorage, retriving it each time, attachibg the new object and again storing. the code works fine, only if there is already an entry in localStorage Following ...
I am storing an array of objects in localStorage, retriving it each time, attachibg the new object and again storing. the code works fine, only if there is already an entry in localStorage Following ...
So I have an HTML table populated with negative and positive values. I want to query the specific values and then upon hovering over the table values less than 0 I want to highlight the row with a red ...
So I have an HTML table populated with negative and positive values. I want to query the specific values and then upon hovering over the table values less than 0 I want to highlight the row with a red ...
url for LinkedIn advanced search: https://www.linkedin.com/vsearch/p?adv=true&trk=advsrch I am trying to fill fields and hit the submit button on the LinkedIn advanced search page using Selenium (...
url for LinkedIn advanced search: https://www.linkedin.com/vsearch/p?adv=true&trk=advsrch I am trying to fill fields and hit the submit button on the LinkedIn advanced search page using Selenium (...
i am making an app where i need 3d joystick image so that user can swipe on it and image will bend in swipped direction. For swipe down or for swipe up events what css or animation effect i should ...
i am making an app where i need 3d joystick image so that user can swipe on it and image will bend in swipped direction. For swipe down or for swipe up events what css or animation effect i should ...