Last active
July 3, 2020 13:35
-
-
Save night-fury-rider/c5cc139121e6a47a132d65e2fda1c7eb to your computer and use it in GitHub Desktop.
What we need is closure - Basic
This file contains 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
var sodexoAmount = 25; | |
function getSalary(baseSalary) { | |
var transportAmount = 50; | |
function calculateSalary(hraAmount) { | |
var specialAllowance = 75; | |
return specialAllowance + hraAmount + baseSalary + transportAmount + sodexoAmount; | |
} | |
return calculateSalary; | |
} | |
var monthlySalary = getSalary(100); | |
console.log(monthlySalary(125)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment