File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,22 @@ Use console.log() to clearly show the before-and-after type conversions.
19
19
*/
20
20
21
21
22
- let result = "5" - 2 ;
22
+ let result = "5" - 2 ; // implicit type conversion didn't need fixed
23
23
console . log ( "The result is: " + result ) ;
24
24
25
- let isValid = Boolean ( " false" ) ;
25
+ let isValid = Boolean ( false ) ; // removed quotation from "false" changing it from a String to a falsey Boolean
26
26
if ( isValid ) {
27
27
console . log ( "This is valid!" ) ;
28
28
}
29
29
30
- let age = "25" ;
31
- let totalAge = age + 5 ;
30
+ let age = "25" ; // added Number() to age variable converting it from a String to a Number
31
+ let totalAge = Number ( age ) + 5 ;
32
32
console . log ( "Total Age: " + totalAge ) ;
33
+
34
+ let hardcoverBookCost = 38 ;
35
+ let paperbackBookCost = 15 ;
36
+ console . log ( `A hardcover book costs $${ hardcoverBookCost } but the paperback only costs $${ paperbackBookCost } .` ) ;
37
+
38
+ let answer = true ;
39
+ console . log ( answer . toString ( ) ) ;
40
+
You can’t perform that action at this time.
0 commit comments