iterate over objects

syntax syntax

 

iterate over objects

var test = {
			//var a = 1; this is wrong in the object
			a:1,b:2,c:
			function (){
				alert("c");
			}
			
		}
		for (var p in test){
			if(typeof(test[p]) == "function"){
				test[p]();
			}else{
				alert(test[p]);
			}
		}

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326996729&siteId=291194637