says I have a long list of item
a
b
c
I want to quickly split them into array, I did
"a
b
c".split('\n')
but I got Uncaught SyntaxError: Invalid or unexpected token
what's the problem?
says I have a long list of item
a
b
c
I want to quickly split them into array, I did
"a
b
c".split('\n')
but I got Uncaught SyntaxError: Invalid or unexpected token
what's the problem?
The code below is my best take, without using the \n operator (there is a much easier way to do a line break in JS) in JavaScript, using a little HTML, using the HTML line break operator. This is my code:
var list = ["a", "b", "c"];
var lineBreak = "<br/>";
document.write(list[0]+lineBreak+list[1]+lineBreak+list[2]);
Is that good enough? Let me know.