1. Javascript对象
function myFun(){
var x;
var txt = "";
var person = {fname:"Bill", lname:"Gate", age:56}
for (x in person){
txt = txt + person[x] + " ";
}
document.getElementById("demo").innerHTML = txt;
}
2. break
cars=["BMW","Volvo","Saab","Ford"];
list:{
document.write(cars[0] + "<br>");
document.write(cars[1] + "<br>");
document.write(cars[2] + "<br>");
break list;
document.write(cars[3] + "<br>");
document.write(cars[4] + "<br>");
document.write(cars[5] + "<br>");
}
时间: 2024-10-13 19:44:32