← Back to If Statements
Question 223
Loose vs Strict Equality
Loose vs Strict Equality
The 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 printsLoosely equalorNot loosely equal. The second uses strict equality===and printsStrictly equalorNot 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 — 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.