javascript: the good parts for humans (part 2)
DESCRIPTION
Introduction to javascript functions.TRANSCRIPT
The good parts for humans
(part 2)
B Anjaneyulu Reddy
Email: [email protected]
Twitter: @_anji
Evibe.in
JavaScript
Agenda
Day 1 revisit
Introduction to Functions
Day 1 revisit
Reserved keywords - ECMAScript 5
JSON recommendation
FPS quesiton
What are the falsy values?
Global abatement
Prototypal inheritance
Functions (1 of 2)
What is a function?
Function are objects in JS
• stored in variables, objects, arrays
• passed as arguments to functions
• functions can be returned from functions
• functions can have methods
Hidden properties
o Function.prototype
o function's context
o code that implements function's behaviour
functionObject.prototype
functions are invoked
Functions (2 of 2)• Function literal
o Four parts
function keyword
optional function name
• used for self calls
parameters
body of the function - set of statements
o can be defined in another function
• this, arguments
• Function Invocation: invocation operator - expression(a, b, ...)
o differ in what this is assigned to
o four patterns
function form
method form
constructor form
apply form
Questions?
Thank You