Bytesize Javascript Stories

Brendan Eich

4th July 1961

10 days*

{ objects }

Finding the object!?

{}
function
[]

22

"wohoo!"

true

null

undefined

A data structure that can hold

key-value pairs.

How about we test for what we want?

instanceof

typeof

FUUUUUUUUUUUUUUUCK!

?

{ return }

Automatic semicolon insertion

 return ;

to the CODE!!!!!!!!!!!!!!!!!!!

?

{ this }

Probably

the

MOST

misunderstood*

thing

JS

in

1) Implicit binding

obj.sayHello();

2) Explicit binding

foo.call(newThis, ...)

foo.apply(newThis,[...])

2.b) Explicit binding

foo.bind(newThis)

3) New keyword

// { }

4) Default rule

this = window*

strict mode => undefined*

What about priority?

  1. Does it have a "new" keyword?

  2. .call()  or .apply() ?!*

  3. Does it have a context object?

  4. Default rule

bind uses apply under-the-hood*

?

{ module }

Hey JS, where's the encapsulation?

public

vs

private

?

{ security }

This problem has been shown to some of the top Javascript experts in the world and they could not see the attack. — Douglas Crockford

Array.prototype.push

No Prototype

Manipulation

?

{ what now?}

Resources

  1. The good parts of Javascript & the Web (FE Masters Course) - https://frontendmasters.com/courses/good-parts-javascript-web/
  2. Written version of the Security problem(article) - http://tinyurl.com/yaxq9seo
  3. The module pattern in depth(article) - https://toddmotto.com/mastering-the-module-pattern/
  4. History of Javascript(video) - https://www.youtube.com/watch?v=wWi9lPEfNHc

Thank you!

Bytesized Javascript Journeys

By Pava

Bytesized Javascript Journeys

  • 326
Loading comments...

More from Pava