Skip to content

Commit ffc5e48

Browse files
Update explicit-and-implicit-conversion-in-javascript.js
1 parent ce92942 commit ffc5e48

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

explicit-and-implicit-conversion-in-javascript.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ Use console.log() to clearly show the before-and-after type conversions.
1919
*/
2020

2121

22-
let result = "5" - 2;
22+
let result = "5" - 2; can run either way as it is subtraction. It may look better without quotes.
23+
let result = Number("5") - 2;
24+
console.log("The result is: " + result + 2);
2325
console.log("The result is: " + result);
2426

2527
let isValid = Boolean("false");

0 commit comments

Comments
 (0)