Notes from Interviews

Front-End Esther

esther

Some notes from those technical interviews I had so far
Talked with some mentors on ADPList 🥰


Pure function

function pure (num) {
  return num * 5;
}

High Order Function

High Order Component

Undefined VS null

UndefinedNull
Declared, but not yet definedNo value, on purpose
The type is undefinedThe type is object
Equal to NaNEqual to 0

THIS

In a method

refer to the owner object (me)

var me = {
  firstName: 'John',
  lastName: 'Doe',
  fullName: function () {
    return this.firstName + ' ' + this.lastName;
  }
}

Alone & Independent

refer to the global object (window)

var x = this.name;

In a function

refer to the global object

function myFunction () {
  return this.name;
}

In a function “strict mode”

undefined

"use strict"
function myFunction () {
  return this.name;
}

In Event Handlers

refer to the HTML Element that received the event (button)

<button onclick="this.style.display='none'">
  Button
</button>

call() & apply() - Explict binding

force the function(a) to refer to the object(b)

var a = {
  fullName: function () {
    return this.firstName + ' ' + this.lastName;
  }
}
var b = {
  firstName: 'John',
  lastName: 'Doe',
}
a.fullName.call(b);