File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // parseInt()
2+ // parseFloat()
3+ // String()
4+ // typeof()
5+
6+ let number = '90' ;
7+ console . log ( typeof ( number ) )
8+
9+ let data = 80 ;
10+ console . log ( typeof ( data ) )
11+
12+ // Type Conversion
13+
14+ data1 = parseInt ( number ) ;
15+
16+ result = data1 + data ;
17+ console . log ( "this is result : " + result ) ;
18+ console . log ( typeof ( data1 ) ) ;
19+
20+ num = '4.5' ;
21+
22+ floatResult = parseFloat ( num ) ;
23+
24+ console . log ( floatResult ) ;
25+ console . log ( typeof ( floatResult ) ) ;
26+
27+
28+
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ <!-- <script src="TypeConversion.js"></script> -->
8+ </ head >
9+ < body >
10+
11+
12+
13+
14+ </ body >
15+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+
8+ < script >
9+
10+ msg = prompt ( 'enter your name = ' )
11+
12+ alert ( msg )
13+
14+ </ script >
15+ </ head >
16+ < body >
17+
18+ </ body >
19+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Document</ title >
7+ < script >
8+
9+ function add ( ) {
10+ let n1 = document . getElementById ( "num1" ) . value ;
11+ let n2 = document . getElementById ( "num2" ) . value ;
12+
13+ let result = + n1 + + n2 ;
14+
15+ //alert(result);
16+ //document.write(result)
17+
18+ document . getElementById ( "printresult" ) . innerHTML = result ;
19+
20+ }
21+
22+ </ script >
23+ </ head >
24+ < body >
25+ < label > Number : 1 </ label >
26+ < input type ="text " id ="num1 "> < br >
27+ < label > Number : 2 </ label >
28+ < input type ="text " id ="num2 "> < br >
29+ < button onclick ="add() "> Result</ button >
30+ < h1 > Result : < span id ="printresult "> </ span > </ h1 >
31+ </ body >
32+ </ html >
You can’t perform that action at this time.
0 commit comments