What is the output of the following code snippet: console.log(1 == '1')?
- TRUE
- FALSE
- undefined
The output of the code snippet is true. In JavaScript, the == operator performs type coercion, so it converts the string '1' to a number before comparing, and 1 is equal to 1.
Loading...
Related Quiz
- What happens when an error is thrown inside an async function and it is not caught within the function?
- How can you match routes with a specific pattern in Express.js?
- Which method is commonly used in Node.js to handle errors in callbacks?
- What is the primary purpose of using JSON Web Tokens (JWT) in authentication?
- When using Jest to test React components, the ______ method is commonly used to render components in a test environment.