Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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
You can’t perform that action at this time.