javascript sucks & frontend challenges @clearslide | while42 sf #7
DESCRIPTION
Presentation by Kyle Powers(@mfkp) & Tyler Davis(@TylerMDavis) for while42 SF #7 hosted by ClearSlideTRANSCRIPT
while42 meetup
JavaScript Sucks
How we deal with it
About Me• Kyle Powers
About Me• Kyle Powers• Enterprise Cloud Meteorologist
About Me• Kyle Powers• Enterprise Cloud Meteorologist• Also work on javascript 99% of my time
About Me• Kyle Powers• Enterprise Cloud Meteorologist• Also work on javascript 99% of my time• I like Sublime Text
JavaScript Quiz
Based on Gary Bernhardt’s “Wat” talk
WAT
WAT
WAT
WAT
WAT
WAT
End Quiz• So how do we deal with this stuff?
How do we deal with this stuff• Education
How do we deal with this stuff• Education• Testing
How do we deal with this stuff• Education• Testing• Chrome developer console
Other bad things about JS• Leaving off the “var” keyword makes a
variable global.
How we solve it• When referencing a global variable “foo”, we
specify “window.foo” to make it clear that it’s global
Other bad things about JS• Callback hell
How we solve it• Refactor – name functions outside of the
scope• Keep functions shallow – usually no more than
2 levels deep• Use the module pattern
"Write small modules that each do one thing, and assemble them into other modules that do a bigger thing. You can't get into callback hell if you don't go there.”
-Isaac Schlueter
Other useful tools• type-check.js• http://gkz.github.io/type-check/
If all else fails, blame it on IE6