javaScript in for-in statement

for-in statement is an accurate iterative statement to enumerate the properties of an object

Example:

<!DOCTYPE html>
<html>
<head>
<title>For-In Statement Example 1</title>
</head>
<body>
<script type="text/javascript">
for (var propName in window) {
document.write(propName);
document.write("<br />");
}


</script>
</body>
</html>

In this example, we show the BOM windows all the properties of an object, each execution cycle will assign a name attribute windows objects that exist to the variable, this process will continue until all the attributes in the object to be enumerated again

Guess you like

Origin www.cnblogs.com/maxiaowei/p/10990485.html