Skip to content

Instantly share code, notes, and snippets.

@AkashRajvanshi
Created November 2, 2019 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkashRajvanshi/584cca459838110f69bc7fce08ea3aff to your computer and use it in GitHub Desktop.
Save AkashRajvanshi/584cca459838110f69bc7fce08ea3aff to your computer and use it in GitHub Desktop.
// 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