I have a string as var a = "000020097613 / 0020";. How can I get the string in two different variables which are currently separated by / now?
I want as below:
var b = "000020097613";
var c = "0020";
I have a string as var a = "000020097613 / 0020";. How can I get the string in two different variables which are currently separated by / now?
I want as below:
var b = "000020097613";
var c = "0020";
 
    
    How about:
var res = a.split(" / ");
var b = res[0], c = res[1];
Or equivalently in ES6:
var [b, c] = a.split(" / ");
 
    
    Try this ES6 solution.
let [b, c] = '000020097613 / 0020'.split(' / ');
The [b, c] syntax is called Array destructuring. It's a part of the destructuring assignment syntax.
