Compare a string and a number
by Ryan Perez
HTML
1. The function compareEquality takes two parameters, a and b.
2. The function compares a and b using the == operator.
3. If a and b are equal, the function returns "Equal".
4. If a and b are not equal, the function returns "Not Equal".
5. The function is called with the arguments 10 and "10".
6. The function compares 10 and "10" using the == operator.
7. Since 10 and "10" are equal, the function returns "Equal".
JavaScript
// Setup
function compareEquality(a, b){
if (a == b){// Change this line
return "Equal";
}
return "Not Equal";
}
// Change this value to test
console.log(compareEquality(10, "10"));