Web Programming Course
SUT • Fall 2018
Arrow functions
let
, const
vs var
Default parameters
Spread, rest operator
Template literals
...
ECMAScript 2015+
The Idea
Backbone
Knockout
Ember
AngularJS
React
Angular
Vue
Progressive Web Apps
Web Applications
Package Managers
Polyfills
Transpilers
Tooling
Task Runners
Bundlers
let
, const
vs var
Arrow Functions
for…of
Default parameters
Spread, rest operator
Template literals
Enhanced object literal
Deconstructing
What's New
let
, const
let a = 50;
const b = 100;
if (true) {
let a = 60;
var c = 10;
console.log(a/c); // 6
console.log(b/c); // 10
}
console.log(c); // 10
console.log(a); // 50
b = 50 // TypeError: Assignment to constant variable.
Arrow Functions & Template Literals
const greetings = name => `hello ${name}`;
import http from './http';
export default class User {
constructor({ name, id }) {
this.data = {
name,
id,
info: {}
}
this.getUserInfo(id)
}
getUserInfo(id = 0) {
return http.get(`/api/users/${id}`)
.then(data => data.json())
.then(data => {
this.data.info = data;
})
.catch(() => {})
}
}