Created
November 2, 2019 14:09
-
-
Save AkashRajvanshi/584cca459838110f69bc7fce08ea3aff to your computer and use it in GitHub Desktop.
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
// Gross Salary = CTC - EPF - Gratuity | |
// Take Home salary = Gross Salary - Income Tax - Employee Pf Contribution - Prof Tax | |
function Salary(grossSalary, incomeTax, employeePF, profTax) { | |
this.grossSalary = grossSalary, | |
this.incomeTax = incomeTax, | |
this.employeePF = employeePF, | |
this.profTax = profTax | |
} | |
const emp1_Salary = new Salary(478000.00, 6750.75, 15000.00, 2400.78) | |
Salary.prototype.valueOf = function takeHomeSalary() { | |
return this.grossSalary - this.incomeTax - this.employeePF - this.profTax; | |
}; | |
// takeHomeSalary = 478000.00 - 6750.75 - 15000.00 - 2400.78 | |
console.log(emp1_Salary.valueOf()) // 453848.47 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment