<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <script> var carname1="Volvo XC60"; var carname2='Volvo XC60'; var answer1='It\'s alright'; var answer2="He is called \"Johnny\""; var answer3='He is called "Johnny"'; document.write(carname1 + "<br>") document.write(carname2 + "<br>") document.write(answer1 + "<br>") document.write(answer2 + "<br>") document.write(answer3 + "<br>") </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <script> var x1=34.00; var x2=34; var y=123e5; var z=123e-5; document.write(x1 + "<br>") document.write(x2 + "<br>") document.write(y + "<br>") document.write(z + "<br>") </script> </body> </html>
<!DOCTYPE html> <html> <body> <script> var i; var cars = new Array(); cars[0] = "Saab"; cars[1] = "Volvo"; cars[2] = "BMW"; for (i=0;i<cars.length;i++) { document.write(cars[i] + "<br>"); } </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <script> var person= { firstname : "John", lastname : "Doe", id : 5566 }; document.write(person.lastname + "<br>"); document.write(person["lastname"] + "<br>"); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <script> var person; var car="Volvo"; document.write(person + "<br>"); document.write(car + "<br>"); var car=null document.write(car + "<br>"); </script> </body> </html>