Created
September 11, 2022 09:48
-
-
Save buymed-hoangpham/2c693750041586fc373e5a835e2f0465 to your computer and use it in GitHub Desktop.
8
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 computers = [ | |
| { type: 'Laptop', price: 124, os: 'Windows' }, | |
| { type: 'Desk', price: 124, os: 'Mac' }, | |
| { type: 'Desk', price: 124, os: 'Windows' }, | |
| { type: 'Laptop', price: 124, os: 'Mac' }, | |
| { type: 'Laptop', price: 124, os: 'Windows' }, | |
| ]; | |
| let totalTotalMacComputers = 0; | |
| let totalTotalWindowsComputers = 0; | |
| computers.forEach((computer) => { | |
| if (computer.os === 'Mac') totalTotalMacComputers++; | |
| if (computer.os === 'Windows') totalTotalWindowsComputers++; | |
| return computer; | |
| }); | |
| console.log( | |
| '๐ ~ file: index.js ~ line 10 ~ totalTotalMacComputers', | |
| totalTotalMacComputers | |
| ); | |
| console.log( | |
| '๐ ~ file: index.js ~ line 12 ~ totalTotalWindowsComputers', | |
| totalTotalWindowsComputers | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment