Loose vs Strict Equality
easyQuestion 223The variable text holds the string "5" and the variable number holds the number 5. Write two if / else statements. The first uses loose equality == and prints Loosely equal or Not loosely equal. The second uses strict equality === and prints Strictly equal or Not strictly equal. Loose equality converts the string to a number before comparing; strict equality also requires the same type, so the two results differ.
Expected output
Loosely equal Not strictly equal
= newline. The output ends with a newline, so print one after the last line.
Hints3 available
Sign in to use hintsTopics
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.