Expedia Interview Question for Software Engineer / Developers


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

In javascript === and !== are strict comparison operators.

JavaScript has both strict and type-converting equality comparison. For strict equality the objects being compared must have the same type and:

Two strings are strictly equal when they have the same sequence of characters, same length, and same characters in corresponding positions.
Two numbers are strictly equal when they are numerically equal (have the same number value). NaN is not equal to anything, including NaN. Positive and negative zeros are equal to one another.
Two Boolean operands are strictly equal if both are true or both are false.
Two objects are strictly equal if they refer to the same Object.
Null and Undefined types are == (but not ===).

- mail4sen May 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

= is for assignment
== && === is for testing equality (strict comparision)

=== can be used to test the typeof property of a variable

e.g.,

if (typeof var === 'object') { do something; }

slightly referenced from JavaScript The Good Parts by Douglas Crockford

- Gokul July 08, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

== is just lame. You don't ever use it since it can cause security loopholes.
[] == false
[] == 0
[] == '' // all these are true, since == boils down to same'ish-ness.
but
[] == [] //false
[] == ![] //true
So it is somewhat unstable.


=== is strict comparison. It does referential comparison for boxed values and structural comparison for unboxed values.
boxed === unboxed //always false

- D July 12, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More