-
-
Save ardydedase/f5ec90d963f95a76f05e66be052f3df6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const addName = (person: object): object => ( | |
| {...person, name: 'John Doe'}) | |
| const addGender = (person: object): object => ( | |
| {...person, gender: 'Male'}) | |
| const addJobTitle = (person: object): object => ( | |
| {...person, title: 'Software Engineer'}) | |
| const addMonthlySalary = (person: object): object => ( | |
| {...person, monthlySalary: 1000}) | |
| const addAnnualSalary = (person: object): object => ( | |
| {...person, annualSalary: person['monthlySalary'] * 12}) | |
| const updateEmployee = (): object => { | |
| let employee: object = { | |
| id: 1, | |
| isActive: true, | |
| } | |
| employee = addName(employee) | |
| employee = addGender(employee) | |
| employee = addJobTitle(employee) | |
| employee = addMonthlySalary(employee) | |
| employee = addAnnualSalary(employee) | |
| return employee | |
| } | |
| console.log(updateEmployee()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment