class Cupboard {
constructor(parent) {
this.parent = parent;
}
delete() {
console.log(this.parent.number);
}
}
class Room {
constructor() {
this.cupboard = new Cupboard(this);
this.number = 5;
}
}
const room = new Room();
room.cupboard.delete();
//5
room.number = 6;
room.cupboard.delete();
//6
console.time('one');
(function(a, b) { a * b })(8, 11)
console.timeEnd('one');
console.time('two');
(function f(a, b) {
var i,
c = 0;
for (i = 0; i < b; i++) {
c += a;
}
})(8, 11);
console.timeEnd('two')
constructor() {
this.handlerClick = ::this.handlerClick;
...
handlerClick() {
//action
}
render() {
const {
handlerOnClick,
...other
} = this.props;
return (
<button onClick={this.props.handlerOnClick|| this.handlerClick} {...other} />
...
let con = 0;
...
masterArray[k].split(',').forEach((vv, kk) => {
if (v.split(',').indexOf(vv) !== -1) {
i++;
con++;
}
});
result.reduce((prev, cur) => prev += +cur.split('- [')[1].split(']')[0], 0)