You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This code works because the implicit type conversion with the - turns "5" into a number
2
+
letresult="5"-2;
3
+
console.log("The result is: "+result);
4
+
5
+
// This code was returning valid because the value was a string, which made the value truthy. Removing the quotations changed it from a string to boolean.
6
+
letisValid=Boolean(false);
7
+
if(isValid){
8
+
console.log("This is valid!");
9
+
}
10
+
11
+
//This code was returning 255 because the value of age was a string. Implicit type conversion will not happen with the +, so Number () was required to cause an explicit type conversion.
0 commit comments