javascript: the good parts for humans (part 2)

7

Click here to load reader

Upload: b-anjaneyulu-reddy

Post on 10-Jul-2015

86 views

Category:

Technology


1 download

DESCRIPTION

Introduction to javascript functions.

TRANSCRIPT

Page 1: Javascript: The good parts for humans (part 2)

The good parts for humans

(part 2)

B Anjaneyulu Reddy

Email: [email protected]

Twitter: @_anji

Evibe.in

JavaScript

Page 2: Javascript: The good parts for humans (part 2)

Agenda

Day 1 revisit

Introduction to Functions

Page 3: Javascript: The good parts for humans (part 2)

Day 1 revisit

Reserved keywords - ECMAScript 5

JSON recommendation

FPS quesiton

What are the falsy values?

Global abatement

Prototypal inheritance

Page 4: Javascript: The good parts for humans (part 2)

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

Page 5: Javascript: The good parts for humans (part 2)

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

Page 6: Javascript: The good parts for humans (part 2)

Questions?

Page 7: Javascript: The good parts for humans (part 2)

Thank You