Created
July 30, 2021 01:48
-
-
Save sergiopichardo/d1c8053bdfc8dfdb62d2b2a271108d11 to your computer and use it in GitHub Desktop.
Solution 4: Using an arrow function
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
| class Employee { | |
| constructor(name, lastName, salary) { | |
| this.name = name; | |
| this.lastName = lastName; | |
| this.salary = salary; | |
| } | |
| getSalaryInfo() { | |
| const calculateMonthlyWages = () => { | |
| return { | |
| name: this.name + ' ' + this.lastName, | |
| monthlyWages: this.salary / 12, | |
| salary: this.salary | |
| } | |
| } | |
| return calculateMonthlyWages(); | |
| } | |
| } | |
| const alexis = new Employee('Alexis', 'Rose', 500_000) | |
| console.log(alexis.getSalaryInfo()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment