repl.it
@Demetrie415/

1.1 Prompts and Conditional Logic

JavaScript

Example answer to the challenge for 1.1

fork
loading
main.js
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
// Create a program that asks the user how many inches they think it will rain this week. 
// Give them one of three different responses based on their prediction.
// var rain = parseInt(prompt("How many inches do you think it will rain this week?"));


// // If the user enters a number greater than 4 inches, log "I should really buy a boat"
// // If the user enters a number that is exactly zero, log "I hope we're not in a drought."
// // If the user enters a number between 0-4 inches, log "I should really buy a raincoat"
// // If the user enters a number less than zero, log "That is just not possible, my friend"
// if (rain > 4){                     
//   console.log("I should really buy a boat");
// }else if (rain === 0) {            
//   console.log ("I hope we're not in a drought."); 
// }else if (rain > 0 && rain <= 4){  
//   console.log("I should really buy a raincoat"); 
// }else {                            
//   console.log("That is just not possible, my friend");
// }

var anime= [ 'naruto']
var  []
for (var  i = 0; i < 5; i= i + 1 ) {
  anime [i]= prompt ('Which one is your fav anime ?')
} console.log (anime)
Native Browser JavaScript
?