-3
I have this variable:
var example = Aclosebclosecclose;
I want to separate the words divided by close-up and store each one in a variable.
Ex:
set an example = Toclose-upBclose-upCclose-up;
var a = A;
var b = B
var c = C;
how could I do that?
-3
I have this variable:
var example = Aclosebclosecclose;
I want to separate the words divided by close-up and store each one in a variable.
Ex:
set an example = Toclose-upBclose-upCclose-up;
var a = A;
var b = B
var c = C;
how could I do that?
3
You can do this using arrays and the method split. Behold:
var exemplo = 'AcloseBcloseCclose';
var variaveis = exemplo.split('close');
console.log(variaveis[0], variaveis[1], variaveis[2])
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.