What is a callback function?

  • A callback function is a type of function that is passed into another function as an argument
  • The first function can execute the callback function at any point
  • The results of the callback function can be used in other functions
  • A function that accepts other functions as arguments is known as a higher order function
  • Callback functions are part of functional programming

What is the difference in var, let and cost?

Var, let and const are three types of variable declarations, the difference between them is the scope and if it can be updated or redeclared.

Var

  • Function scope, accessible anywhere inside of the function
  • Can be updated and redeclared

Let

  • Block scope, accessible only inside the code block its defined
  • Can be updated, can’t be redeclared

Const

  • Block scope, accessible only inside the code block its defined
  • Can’t be updated or redeclared

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

In JavaScript =, == and === perform different functions

= is an assignment operator and is used to assign something to a variable

For example X = 5

== is a comparison operator used to compare values but does not compare type

For example 1 == “1” is true

=== is a comparison operator used to compare values and compares type

For example 1 === “1” is false