Slide 43
Slide 43 text
const square = (l, x, y) => {
const this = [l, x, y];
const rotate = (self, d) => (…);
const move = (self, x, y) => (…);
return {
rotate: (d) => rotate(this, d),
move: (x, y) => move(this, x, y)
//...
}
};
const obj = square(5, 10, 15);
obj.rotate(…);