Created
          May 9, 2014 13:23 
        
      - 
      
- 
        Save psahni/81fd42e88d02dab679fa to your computer and use it in GitHub Desktop. 
    clousures in javascript
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function add(x,z) { | |
| value = function(y) { | |
| return x + y; | |
| }; | |
| if(typeof(z)=='undefined'){ | |
| return value; | |
| }else{ return (x+z);} | |
| } | |
| alert(add(5,6)); | |
| alert(add(5)(6)); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment