-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
95 lines (80 loc) · 1.84 KB
/
script.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
const prompt = require( "prompt-sync")({sigint:true})
//Types of data types
/*let x =3;
console.log (x);
let myNumb=8;
let myNumb2= 4;
let newResult= myNumb + myNumb / myNumb2
console.log (newResult);
let kelvin = 45;
let fahrenheit = 59
let celsius = (32*fahrenheit-32)*(5/9);
console.log (celsius);
let name1= "SEUN";
let name2= "seun";
if (name1 == name2){
console.log("same");
}
else { console.log ("not same")};*/
// test for room temperature
/*let temp1= 12
if ( temp1 <= 38){
console.log ( "good to go");
}
else if(temp1 >= 38) {
console.log ("too hot");
}
else if ( temp1 > 38)
{console.log ("extremely hot");}
/*
let names = [ "seun", "tosin", "tope"];
let games = {name1 :"candycrush", name2 :"psa" };
for (name in names) {
console.log (name);
}
*/
/*
let r = false
let i = 1
while(i< 10) {
if ( i===5){
console.log ("thankyou");
break;
}
}
*/
/*
let name =prompt ( "what is your name:");
*/
/*
let input1 = prompt("num1") ;
let input2 = prompt( "num2");
let input = input1 + input2
let x= parseInt(input1);
let y= parseInt(input2);
console.log (input)
*/
/*
let guessNumber = 4;
let userGuessNumber = parseInt (prompt ("what is the number ?"));
if ( guessNumber === userGuessNumber){
console.log ( "you are right!");
}
else {console.log("you are wrong!")}*/
// Game of trials
let guessNumber = 4;
let userGuessNumber = parseInt (prompt ("what is the number ?"));
for ( i = 0; i <4; i++){
//console.log('userGuessNumber: ', userGuessNumber)
if (userGuessNumber === guessNumber){
console.log( "Congratulation! you guessed right.");
break;
}
else {
userGuessNumber = parseInt (prompt ("Have another guess! What is the number?"));
console.log( "Try again!");
}
}
if ( userGuessNumber !== guessNumber){
console.log ( "Number of trials exceeded")
}