Thursday, July 25, 2013

OSCON New Rules For JavaScript

The New Rules For JavaScript page on OSCON site.

Kyle Simpson (Getify Solutions)
4:10pm Thursday, 07/25/2013

54y.geti.fi/slides/js-rules/oscon

Kyle is writing youdontknowjs.com

html5hub.com

linters - jslint, jshint, eslint
- use for checking and agreeing on style

stop thinking JS (as a dynamic language) doesn't have types

!! same as Boolean(a)

7 types:
null, undefined, boolean, string, number, object, function
can get type by using typeof  except for null which will return object

stop thinking JS variables have types

values have types, and those types can't change but vriables can hold any value at any time

== allows coercion
=== disallows coercion

null == undefined // true

stop using anonymous functions
- improves readability of stack when debugging
- also name IIFE
- named functions are always better

don't assume the JS engine optimizes away mistakes

stop abusing function scope

block scoping is better than manually hoisting variables

 let() {}
- does not exist yet
- can use blockscope.js on GitHub

 stop using this until you really understand how it gets assinged
is the call-site new-invoked? use that
is the call-site binding overriden with call/apply?
... add more from slides

stop using new Something() "constructors" to "instantiate" ...

OO vs OLOO (Objects Linked to Other Objects)
class vs delegation oriented code

delegation oriented programming

No comments:

Post a Comment