Microsoft interview question #4 – Evaluate JavaScript Equality/Coercion Expressions

22 Views
No Comments

Problem statement(题目原文)
Given:

const a = 1;
const b = '1';

What is the result of each of the following statements?

a == b
a === b
!a === !b
a + b
a + +b

Brief idea
Know == performs coercion (string → number), === doesn’t; + concatenates when a string is involved; unary + coerces to number.

The VOprep team has long accompanied candidates through various major company OAs and VOs, including Microsoft Google, Amazon, Citadel, SIG, providing real-time voice assistance, remote practice, and interview pacing reminders to help you stay smooth during critical moments. If you are preparing for Stripe or similar engineering-focused companies, you can check out our customized support plans—from coding interviews to system design, we offer full guidance to help you succeed.

END
 0