senchacon 2016: javascript is great but stop writing it - rory hardy
TRANSCRIPT
JavaScript is GreatBut Stop Writing It
Rory Hardy — @gneatgeek
When Do You Write JavaScript?
JavaScript
$('button') .on('mousedown', function () { this.style.background = '#ccc'; }) .on('mouseup', function () { this.style.background = '#fff'; });
HTML + CSS
<button>Button Text</button> button { background-color: #fff;}button:active { background-color: #ccc;}
Stop Writing JavaScript?
Image Source: www.f-lohmueller.de/
Let's Talk About HTML5
Content
• Form validation
• Audio
• Video
• More
Let's Talk About CSS
Presentation
• Animation
• Transforms
• Flexbox
• More
Image Source: https://mdn.mozillademos.org
Let's Talk About JavaScript
Behavior and user interactivity
jQuery's Role in DOM Development
• Abstraction of Document Object Model (DOM)
• Not a JavaScript replacement
Snowball!!
Writing Better JavaScript
• Learn Vanilla JavaScript
• Read “JavaScript: The Good Parts” by Douglas Crockford
• Leverage available tools
• Leverage libraries/frameworks when they solve your problem
Globals
BOOM!
Plane image source: Mario Paint
Events
Image Source: diylol.com
Delegation
Image Source: digitalbrandinginstitute.com
Static Analysis (Linter)
for (var i = 0; i < 10; i++) { for (var i = 0; i < 5; i++) { // logic }}
Static Analysis (Linter)
• JSLint
• JSHint
• ESLint
• More
Image Source: memegenerator.net