-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample1.js
More file actions
40 lines (29 loc) · 1.02 KB
/
example1.js
File metadata and controls
40 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Description: This program is locked into an infinite loop. Your task is to run and debug the program.
*
* TODO: The program should exit the loop after counting down from 5 to 1. You should check to make sure the boolean statement
* is being updated.
*/
function checkPoint1() {
alert1();
let array = [];
let x = 0;
// TODO: Remove the bugs from the code below.
function getMultiples(array) {
while ( x <= 50){
array.push(x*2);
x++
}
return array;
}
console.log(getMultiples(array));
// DO NOT CHANGE THE CODE BELOW
alert2();
}
/************************************************ DONT CHANGE THE CODE BELOW ******************************************************/
function alert1() {
alert("Oh no! It looks like you are trapped in an infinite loop. Go to the example1.js file and work on checkpoint 1.");
}
function alert2(){
alert("Congratulations! You have passed checkpoint 1!");
}