Javascript Tutorial For Beginners 11 # JavaScript for Loop







<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>javascript</title>
</head>
<body >
<p id="demo"></p>
<p id="demo1"></p>

<script type="text/javascript">
var a;
var result="";
/* while (a <= 10) {
result += "<br>" + a;
a++;
}*/

var names = ["tom", "mark","Ben","jack","john"];
for (a=0,result=""; a < names.length ; a++) {
result += "<br>" + names[a];
}
document.getElementById("demo").innerHTML= result ;

var student = {name:"Mark", surname:"tesar", age:22};
var x;
var result1="";
for (x in student)
result1 += "<br>" + student[x];
document.getElementById("demo1").innerHTML= result1 ;

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







Javascript Tutorial For Beginners 11 # JavaScript for Loop Javascript Tutorial For Beginners 11 # JavaScript for Loop Reviewed by Mursal Zheker on Sabtu, November 14, 2015 Rating: 5

Tidak ada komentar:

Diberdayakan oleh Blogger.