javascript: enter the dragon

63
JavaScript

Upload: dmitry-baranovskiy

Post on 15-May-2015

3.616 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: JavaScript: enter the dragon

JavaScript

Page 2: JavaScript: enter the dragon

JavaScriptEnter the Dragon

Page 3: JavaScript: enter the dragon
Page 4: JavaScript: enter the dragon

Most misunderstood language

Page 5: JavaScript: enter the dragon

You have no choice

Page 6: JavaScript: enter the dragon

…but you have plenty of options

Page 7: JavaScript: enter the dragon

JavaScript

Page 8: JavaScript: enter the dragon

JavaScript human body

Page 9: JavaScript: enter the dragon

“If you have a body, you are an athlete”

Bill Bowerman, co-founder of Nike.

Page 10: JavaScript: enter the dragon

If you code for the Web,you are a JavaScript Developer

Page 11: JavaScript: enter the dragon

Control

Page 12: JavaScript: enter the dragon
Page 13: JavaScript: enter the dragon

Why you “unfit”?

Page 14: JavaScript: enter the dragon

Why your JavaScript sucks?

Page 15: JavaScript: enter the dragon
Page 16: JavaScript: enter the dragon
Page 17: JavaScript: enter the dragon

“This is not important”

“I don’t need it any more, it’s XXI century”

“I am good enough!”

“It’s way too complicated”

“I don’t have time for this”

Page 18: JavaScript: enter the dragon

Kyle Maynard — MMA fighter

Page 19: JavaScript: enter the dragon

Kyle Maynard — MMA fighter

Page 20: JavaScript: enter the dragon

Kyle Maynard — MMA fighter

Excuses… Let’s hear yours again

Page 21: JavaScript: enter the dragon

There are no shortcuts

Page 22: JavaScript: enter the dragon

“Those who are unawarethey are walking in darknesswill never seek the light.”

Bruce Lee

Page 23: JavaScript: enter the dragon

Six essential bits

Page 24: JavaScript: enter the dragon

Six pack

Page 25: JavaScript: enter the dragon

Types & type coercion1

Page 26: JavaScript: enter the dragon

objectnumber

stringboolean

nullundefined

Page 27: JavaScript: enter the dragon

5 - "4"5 + "4"+!{}[true]+[1]+[1, 2]7 - "a"7 / 0…

Page 28: JavaScript: enter the dragon

Operators,especially “+” & “==”2

Page 29: JavaScript: enter the dragon

5 + "4"5 + null4 == "4.00"null == undefined0 == false0 == nullnull == false

Page 30: JavaScript: enter the dragon

typeof null == "object"typeof function () {} == "function"

Page 31: JavaScript: enter the dragon

Objects & primitives3

Page 32: JavaScript: enter the dragon

var a = "string";alert(a.length);a.t = 3;alert(a.t);

Page 33: JavaScript: enter the dragon

Functions & constructors4

Page 34: JavaScript: enter the dragon

function f() {};

var a = f, b = f(), c = new f, d = f(f);

Page 35: JavaScript: enter the dragon

Closures5

Page 36: JavaScript: enter the dragon

function add(a) { return function (b) { return a + b; };}

add(3)(4) == 7

Page 37: JavaScript: enter the dragon

Prototype6

Page 38: JavaScript: enter the dragon

Prototypes in JavaScriptin 5 minutes

Page 39: JavaScript: enter the dragon

function f() {};f P

Page 40: JavaScript: enter the dragon

function f() {};f.prototype.x = 3; f P x: 3

Page 41: JavaScript: enter the dragon

function f() {};f.prototype.x = 3;var a = new f;

f P x: 3

a

Page 42: JavaScript: enter the dragon

function f() {};f.prototype.x = 3;var a = new f;a.x = 2;a.y = 1;

f P x: 3

x: 2y: 1

a

Page 43: JavaScript: enter the dragon

function f() {};f.prototype.x = 3;var a = new f;a.x = 2;a.y = 1;var b = new f;

f P x: 3

x: 2y: 1

a b

Page 44: JavaScript: enter the dragon

function f() {};f.prototype.x = 3;var a = new f;a.x = 2;a.y = 1;var b = new f;f.prototype = {z: 0};

f PP2 x: 3z: 0

x: 2y: 1

a b

Page 45: JavaScript: enter the dragon

function f() {};f.prototype.x = 3;var a = new f;a.x = 2;a.y = 1;var b = new f;f.prototype = {z: 0};var c = new f;

f PP2 x: 3z: 0

x: 2y: 1

ac b

Page 46: JavaScript: enter the dragon

function f() {};f.prototype.x = 3;var a = new f;a.x = 2;a.y = 1;var b = new f;f.prototype = {z: 0};var c = new f;

f PP2 x: 3z: 0

x: 2y: 1

ac b

b.constructor == fc.constructor == Object

Page 47: JavaScript: enter the dragon

I didn’t get it…

Page 48: JavaScript: enter the dragon

Function.constructor == Function

Page 49: JavaScript: enter the dragon
Page 50: JavaScript: enter the dragon

Nobody knows what to do

Page 51: JavaScript: enter the dragon
Page 52: JavaScript: enter the dragon

http://www.udel.edu/anthro/neitzel/supplemental%20sportsS09.htm

Page 53: JavaScript: enter the dragon

Different goalsdemand different approaches

Page 54: JavaScript: enter the dragon

Form always follows the function

Page 55: JavaScript: enter the dragon

http://www.flickr.com/photos/sgroi/3228398172/

Page 56: JavaScript: enter the dragon

http

://en

.wik

iped

ia.o

rg/w

iki/

Her

cule

s_of

_the

_For

um_B

oariu

m

Page 57: JavaScript: enter the dragon
Page 58: JavaScript: enter the dragon

http://www.flickr.com/photos/stebbz/2451346427/

Page 59: JavaScript: enter the dragon
Page 60: JavaScript: enter the dragon
Page 61: JavaScript: enter the dragon

Thank You

Page 62: JavaScript: enter the dragon

“A wise man can learn more froma foolish questionthan a fool can learn froma wise answer.”

Bruce Lee

Page 63: JavaScript: enter the dragon

“If you spend too much timethinking about a thing,you’ll never get it done.”

Bruce Lee