File tree Expand file tree Collapse file tree 4 files changed +67
-0
lines changed
Expand file tree Collapse file tree 4 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "editor.inlineSuggest.showToolbar" : " always"
3+ }
Original file line number Diff line number Diff line change @@ -29,7 +29,16 @@ <h2 id="truth">I am I taller guy?</h2>
2929 < h3 id ="bmi "> I will come to this with JavaScript</ h3 >
3030 </ diV >
3131
32+
33+ < div id ="gs ">
34+ < h3 class ="guess "> Guess a number</ h3 >
35+ < button onclick ="guess_num2() ">
36+ Click Here
37+ </ button >
38+ </ div >
39+
3240 < script src ="/src/script/app.js "> </ script >
3341 < script src ="/src/script/main.js "> </ script >
42+ < script src ="/src/script/typeconv.js "> </ script >
3443</ body >
3544</ html >
Original file line number Diff line number Diff line change 1+ // type conversion
2+ // const year = "2022"
3+ // const num_year = parseInt(year)
4+ // const num_year_2 = Number(year)
5+ // console.log(typeof(num_year),typeof(num_year_2));
6+
7+ // const num_year_3 = "m17z"
8+ // console.log(Number(num_year_3),parseInt(num_year_3));
9+
10+ // type coercion
11+
12+ // const num = "10"
13+ // const num2 = "20"
14+ // console.log(num + num2);
15+ // console.log("I am "+ 29 + " years old");
16+ // console.log(num2 - num);
17+ console . log ( "5" + 5 + 5 - 55 ) ;
18+ console . log ( 10 + "20" ) ;
19+ console . log ( "20" - 10 ) ;
20+ console . log ( + '20' - 5 ) ;
21+ console . log ( + "10" + 10 ) ;
22+ console . log ( - "10" + 30 ) ;
23+
24+ // play a game which is guess a number between 1 to 10
25+
26+ const guess_num = ( ) => {
27+ const num3 = 8 ;
28+ let guess = prompt ( "Guess a number between 1 to 10: " ) ;
29+ if ( guess == num3 ) {
30+ let message = ( document . getElementById ( "guess" ) . innerHTML =
31+ "You are correct" ) ;
32+ } else {
33+ let message = ( document . getElementById (
34+ "guess"
35+ ) . innerHTML = `You are wrong. the number is ${ num3 } ` ) ;
36+ }
37+ } ;
38+
39+
40+ const guess_num2 = ( ) => {
41+ const num3 = 6 ;
42+ let guess = prompt ( "Guess a number between 1 to 10: " ) ;
43+ if ( guess == num3 ) {
44+ let message = document . getElementsByClassName ( "guess" ) [ 0 ] ;
45+ message . innerHTML = "You are correct" ;
46+ } else {
47+ let message = document . getElementsByClassName ( "guess" ) [ 0 ]
48+ message . innerHTML = `You are wrong. the number is ${ num3 } ` ;
49+ }
50+ } ;
Original file line number Diff line number Diff line change 7272 width : 60% ;
7373 margin : auto;
7474 }
75+
76+ # gs {
77+ margin-left : 40% ;
78+ margin-top : 10px ;
79+ }
You can’t perform that action at this time.
0 commit comments