No you can only var letters, numbers and some special chars such as _ (underscore), but to do what you want you can do this. var car_name = ['Ford Escape']; and then you can do this alert(car_name[0]); // alerts Ford Escape
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
OK, I guess this is the example I was thinking of (I got it off of W3Schools) and it's also why I'm confused. SO i use an Array to list the vehicles (or whatever I want to list), correct?
<script type="text/javascript">
var x;
var mycars = new Array();
mycars[0] = "Saab";
mycars[1] = "Volvo";
mycars[2] = "BMW";
for (x in mycars)
{
document.write(mycars[x] + "<br />");
}
</script>
Most codes these days use the object array to store the array data for example like this.
Code:
<script type="text/javascript">
var x,
mycars = ["Saab","Volvo","BMW"];
for (x in mycars) {
document.write(mycars[x] + "<br />"); // x equals the current array item number
}
</script>
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
Most codes these days use the object array to store the array data for example like this.
Code:
<script type="text/javascript">
var x,
mycars = ["Saab","Volvo","BMW"];
for (x in mycars) {
document.write(mycars[x] + "<br />"); // x equals the current array item number
}
</script>
Always funny seeing what you have just posted is the same as someone else's, explaining more or less the same thing.
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P