Possible Duplicate:
Possible to assign to multiple variables from an array?
If in python i can do this
x = "Hi there and hello there"
v1, v2, v3, v4, v5 = x.split(" ")
but im not sure how to do it in javascript..
You can turn it into an array by using javascript .split
For example
x = "Hi there and hello there";
var array = x.split(" ");
Then all your variables will be in the array like below
array[0]
array[1]
array[2]
You can show this using console.log or an alert like so.
console.log(array[0]);
alert(array[0]);
References
http://www.tizag.com/javascriptT/javascript-string-split.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With