You fought the good fight. You screamed to the heavens. You held fast and faced the dying of the light. But it's over now: JavaScript has won.
No longer confined to web apps, it's on the server. It's on IoT devices. It's on your phone. It's on your desktop. It's everywhere now. But, that doesn't have to be a bad thing! The JavaScript World isn't perfect, but if you can get past "THE SKY IS FALLING!", there's plenty to like about it. In this talk, you will learn about the essential tools and techniques that will make your developer life a happy one in this brave new world.
23. Then vs. Now
Prototypical inheritance
Lots of jQuery
Redefined undefined
More jQuery
var that = this;
jQuery
Hoisting
IIFEs
Globals
jQuery
Classes
Arrow functions
Generators
Modules
Better libraries and frameworks
And lots more!
(don’t worry, we still have the bad
parts!)
24. The World as it Exists Today
import {Todo} from './todo';
export class Index {
constructor() {
this.heading = 'Todos';
this.todos = [];
this.todoDescription = '';
}
addTodo() {
if (this.todoDescription) {
this.todos.push(new Todo(this.todoDescription));
this.lastAction = `Added new item: ${this.todoDescription}`;
this.todoDescription = '';
}
}
}
25. There’s Also TypeScript
import { Component } from '@angular/core';
import { NgForm } from '@angular/forms';
@Component({
selector: 'page-user',
templateUrl: 'signup.html'
})
export class SignupPage {
signup: {username?: string, password?: string} = {};
submitted = false;
constructor(public navCtrl: NavController, public userData: UserData) {}
onSignup(form: NgForm) {
this.submitted = true;
if (form.valid) {
this.userData.signup(this.signup.username);
this.navCtrl.push(TabsPage);
}
}
}
33. Your JavaScript Bug-Out Bag
Visual Studio Code
NodeJS
NPM
Aurelia or <insert other popular framework>
MODERN JavaScript (or TypeScript)
Babel
Lo-dash