JavaScript Advanced

Topics 

  • JavaScript functions as first-class objects 
  • Self-invoking function 
  • Function scope 
  • What is Closure? (Closure examples) 
  • Why use Closure? (Closure usage examples) 
  • Global object, non-global object, and “this”

JavaScript Functions as First-class Objects

A function is a first-class JavaScript Object (like String or Number object) 

  • Functions are a bit like Java methods (like in Java) 
    • They contain statements for performing some tasks 
    • They have arguments and return values 
  • A function is a first-class object in JavaScript (unlike in Java 7) 
    • Can be considered as a descendant of Object object 
    • Can do everything a regular JavaScript object can do such as having properties and their values 
    • Function objects can have other function objects as methods 
  • A function behaves like a first-class object (unlike in Java 7) 
    • It can be saved into a variable (like String object) 
    • It can be passed as an argument to another function 
    • It can be returned as a object

You must have an active subscription to download PDF,Lab Zip and Recordings of this course topic.Please click the "Subscribe" button or the "Login" button if you already have an account.