Monday, July 18, 2016

JavaScript - Bind

function getCount() {
    return this.myCount++;
}


> var counter2 = getCount.bind({myCount:100});
undefined
> counter2()
100
> counter2()
101

No comments: