In the lecture, we should incorporate some array to have a review in your new lo
ID: 3890971 • Letter: I
Question
In the lecture, we should incorporate some array to have a review in your new loop programming (specifically, for … in loop). In your text editor, create the script listed in the following, save it as arrayforin.html
<html>
<head>
<title>Array,Loops and Control</title>
</head>
<body>
<script>
var days =['Sun','Mon','Tue','Wed','Thr','Fri','Sat'];
var message="";
for (i in days) {
message +='Day' + i + 'is' +days[i] +' ';
}
alert(message);
</script>
<body>
</html>
Explanation / Answer
1. open notepad
2. copy whole text as listed below:-
<html>
<head>
<title>Array,Loops and Control</title>
</head>
<body>
<script>
var days =['Sun','Mon','Tue','Wed','Thr','Fri','Sat'];
var message="";
for (i in days) {
message +='Day ' + i + ' is ' +days[i] +' ';
}
alert(message);
</script>
<body>
</html>
3. save it as arrayforin.html
4. run the file or browser.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.