Skip to content

Instantly share code, notes, and snippets.

View Cygra's full-sized avatar
😅
I'm silly. □␣□

Cygra Wang Cygra

😅
I'm silly. □␣□
View GitHub Profile
var foo = () => arguments[0];
foo(); // arguments is not defined
function bar() {
return arguments[0];
}
bar(); // undefined
let arr = (...params) => console.log(params);
arr(1, 2, 3)
// [1, 2, 3]
let foobar = (param1, param2 = "param2") => {
console.log(param1);
console.log(param2);
}
foobar(1);
// 1
// param2
var FooBar = () => {};
console.log(FooBar.prototype);
// undefined
let Clock = () => {
this.sec = 0;
setInterval(() => {
this.sec ++;
}, 1000)
}
var newClock = new Clock();
"use strict";
function Clock() {
var _this = this;
this.sec = 0;
setInterval(function () {
_this.sec++;
}, 1000);
}
@Cygra
Cygra / clock
Last active April 11, 2019 10:18
function Clock(){
this.sec = 0;
setInterval(() => {
this.sec ++;
}, 1000)
}
var newClock = new Clock();