Skip to content

Commit ce92942

Browse files
committed
initial commit
0 parents  commit ce92942

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
3+
Part 1: Debugging Challenge
4+
The JavaScript code below contains intentional bugs related to type conversion.
5+
Please do the following:
6+
- Run the script to observe unexpected outputs.
7+
- Debug and fix the errors using explicit type conversion methods like Number() , String() , or Boolean() where necessary.
8+
- Annotate the code with comments explaining why the fix works.
9+
10+
Part 2: Write Your Own Examples
11+
Write their own code that demonstrates:
12+
- One example of implicit type conversion.
13+
- One example of explicit type conversion.
14+
15+
*We encourage you to:
16+
Include at least one edge case, like NaN, undefined, or null .
17+
Use console.log() to clearly show the before-and-after type conversions.
18+
19+
*/
20+
21+
22+
let result = "5" - 2;
23+
console.log("The result is: " + result);
24+
25+
let isValid = Boolean("false");
26+
if (isValid) {
27+
console.log("This is valid!");
28+
}
29+
30+
let age = "25";
31+
let totalAge = age + 5;
32+
console.log("Total Age: " + totalAge);

0 commit comments

Comments
 (0)