Tag Archives: Tutorial

In depth JavaScript : Apply / Call

Why use Apply or Call?

Call takes the value to be used as the “this” object as the first object in the parameter list. The rest of the parameters will come after the first object and separated by commas.

callFunction.call(thisObjectPassedIn, param1, param2)

Apply is just like call but the second parameter is an array of parameters.

applyFunction.apply(thisObjectPassedIn, [param1, param2])

In depth JavaScript : Callbacks

JavaScript – Object based language

Functions are OBJECTS

var myFunction = function(){

function doFunction(myFunction){
  //do something

Things to understand about functions

  • functions can be stored as a variable
  • functions take parameters that can be variables
  • can be created by functions
  • can be returned from functions

Continue reading