Educate And Advocate
All about very small logical and programming problems. Complex theories made simple to understand
Showing posts with label
closure
.
Show all posts
Showing posts with label
closure
.
Show all posts
Thursday, August 28, 2014
Example for Closure, .call, .apply in javascript
function add(y,z){
function fn(x,y,z){
console.log(Math.round(x+y)*z);
};
fn(this.x,y,z);
};
add.call({x: 20.1},3.1,5.1); // 117.3
add.apply({x: 20.1},[3.1,5.1]); // 117.3
Older Posts
Home
Subscribe to:
Posts (Atom)