JS Interview Questions

Tyler Knapp
2 min readJul 15, 2020

--

Below are some interview questions you might run into.

What is the difference between var, let and const?

Global Scope: var

Local Scope: let + const

Hoisted: var

Not Hoisted: let + const

Redeclare Variable: var

Cannot Redeclare Variable: let + const

Can give the variable a new value: var + let

Cannot give the variable a new value: const

What is the difference between undefined and null?

undefined: has been declared, but not yet assigned a value

null: is an assignment value. It can be assigned to a variable as a representation of no value

What is NaN?

The NaN property represents a value that is “not a number”.

What are the JS Data Types?

  • Number
  • String
  • Boolean
  • Object
  • Undefined

What is the 'this' keyword in JS?

this references the object that it was called on.

What is the difference between == and ===?

=== represents the strict equality operand which returns true is the value and type are equal.

== will return true if the value is the same, but does not take type into account.

What is type coercion?

Type coercion can best be explained with the following code:

console.log(5 + "5")
// outputs 55

Type coercion means that when the operands of an operator are different types, one of them will be converted to an “equivalent” value of the other operand’s type.

Is JS a statically or dynamically typed language?

JS is a dynamically typed language, meaning the type is associated with run-time values, and not named variables/fields/etc.

--

--

Tyler Knapp

A recent graduate of the immersive, software engineering program at the Flatiron School in NYC.