1. Home
  2. >
  3. Closures
5

Closures
rishabh jain rishabh jain

Something to know about closure

# javascript
//Closures are interesting !!
function Closures=(x)=>{
  
  return function(y){
    
    return x+y;
  }
}

console.log(Closures(3)(4))  // 7

Discussions (20)

dont knmow

  • 0
  • Reply

dont knmow

  • 0
  • Reply
Candidate Image

7 is the answer

  • 0
  • Reply

7 is the answer

  • 0
  • Reply
Candidate Image

7

  • 0
  • Reply

7

  • 0
  • Reply
Candidate Image

7

  • 0
  • Reply
Candidate Image

Yes i know 7

  • 0
  • Reply

7

  • 0
  • Reply
Candidate Image

7

  • 0
  • Reply
Candidate Image

The answer is 7

  • 0
  • Reply
Candidate Image

It should give SyntaxError: Unexpected token '=', because, in line:2, there's err of arrow function

  • 0
  • Reply
Candidate Image

7

  • 0
  • Reply

7 is the answer

  • 0
  • Reply
Candidate Image

7

  • 0
  • Reply

7 is the output

  • 0
  • Reply

syntax Error : Unexpected token '='

  • 0
  • Reply

SyntexError

  • 0
  • Reply

closure function is supposed to be self function. so it can be written as

  • 0
  • Reply

closure function to be defined by self invoking

  • 0
  • Reply
# javascript