Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Muhammad Warrad HW #12

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 45 additions & 20 deletions lib/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
function prompt1() {
for (let i = 0; i <= 10; i++) {
console.log(i);
}
};
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
// prompt1()

//console.log(function);
// 🌟 MAKE A COMMIT: "Complete prompt 1"

/*
Expand All @@ -35,11 +35,13 @@ function prompt1() {
*/

function prompt2() {
// YOUR CODE HERE
for( let i = 2; i < 100; i += 2) {
console.log(i);
};
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
// prompt2();
// prompt2();

// 🌟 MAKE A COMMIT: "Complete prompt 2"

Expand All @@ -50,7 +52,9 @@ function prompt2() {
*/

function prompt3() {
// YOUR CODE HERE
for(let i = -5; i <= 5; i ++) {
console.log(i);
}
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
Expand All @@ -65,7 +69,9 @@ function prompt3() {
*/

function prompt4() {
// YOUR CODE HERE
for(let i = 10; i >= 0; i --) {
console.log(i);
}
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
Expand All @@ -79,9 +85,10 @@ function prompt4() {
* Create a loop that counts down from 5 to -5, printing each number (including 5 and -5).
*/
function prompt5() {
// YOUR CODE HERE
for(let i = 5; i >= -5; i --) {
console.log(i);
}
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
// prompt5()

Expand All @@ -95,9 +102,10 @@ function prompt5() {
*/

function prompt6() {
// YOUR CODE HERE
for(let i = 0; i <= 50 ; i +=2) {
console.log(i);
}
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
// prompt6()

Expand All @@ -114,7 +122,11 @@ function prompt6() {
* - I found a 10. High five!
*/
function prompt7() {
// YOUR CODE HERE
for(let i = 0; i <= 100 ; i +=5){
if(i % 5== 0){
console.log(`I found a ${i}. High Five!`)
}
}
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
Expand All @@ -135,17 +147,26 @@ function prompt7() {
*/

// define someNumber here
var someNumber;
var someNumber = 22;

function prompt8() {
// print someNumber to the console in your function so you can see its value
someNumber = Math.floor (Math.random()*99) + 1
console.log(someNumber);
if(someNumber <= 30){
console.log("That's a small number!")

} else if (someNumber >= 30 && someNumber <= 60 ) {
console.log ("The number is medium sized.")

} else if (someNumber >= 60){
console.log("We got a big one!");
}

// YOUR CODE HERE
}

// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
// prompt8();
prompt8();

// 🌟 MAKE A COMMIT: "Complete prompt 8"

Expand All @@ -160,11 +181,14 @@ function prompt8() {
* 2. R2D2
*/

const starWars = ["Han", "C3PO", "R2D2", "Luke", "Leia", "Anakin"];

const starWars = ["Han", "C3PO", "R2D2", "Luke", "Leia", "Anakin"]
function prompt9() {
// YOUR CODE HERE
}
for (i = 0; i<starWars.length; i++) { console.log(`${i}.${starWars[i]}`)

}

};


// COMMENT IN THE BELOW LINE OF CODE TO TEST YOUR OUTPUT IN THE BROWSER!
// prompt9();
Expand All @@ -179,8 +203,9 @@ function prompt9() {
*/
function prompt10() {
const myArray = [];
// YOUR CODE HERE

for (i = 0; i < 101; i+=2){ myArray.push(i)
console.log(myArray);}

// don't forget to return the array after pushing the numbers into it so you can see it in the browser!
// return the array
return myArray;
Expand Down