Skip to content

Instantly share code, notes, and snippets.

@Y2017
Y2017 / ANG2_ts_ducktyping_emailable.ts
Last active December 11, 2016 13:08
ANGULAR2_training plan
// Le typage TypeScript ne se base pas sur les interfaces mais sur les "Shapes" inspirées du "Duck Typing" Python.
// "If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck."
// If we don't have access to external classes
class User {
firstName: string;
lastName: string;
email: string;
}
@Y2017
Y2017 / es6_01_class.js
Last active February 28, 2017 16:26
ES6
// this
// JS Function : Without using the "strict" mode, this refers to the context in which someFunction() was called
// In "strict" mode, this would be undefined, which is slightly less confusing.
// http://jsbin.com/vekawimihe/2/edit?js,console
// When this is used inside an arrow function JavaScript uses the this from the outer scope
// class
class Hamburger {
constructor() {
// This is the constructor.