Created
October 1, 2022 09:30
-
-
Save NhanKhangg98/dde4efdd987db5d58f205692dd21c82d 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
| type Movie = { | |
| readonly title: string, | |
| originalTitle?: string, | |
| director: string, | |
| releaseYear: number, | |
| boxOffice: { | |
| budget: number, | |
| grossUS: number, | |
| grossWorldwide: number, | |
| }, | |
| } | |
| const dune: Movie = { | |
| title: "Dune", | |
| originalTitle: "Dune Part One", | |
| director: "Denis Villeneuve", | |
| releaseYear: 2021, | |
| boxOffice: { | |
| budget: 165000000, | |
| grossUS: 108327830, | |
| grossWorldwide: 400671789, | |
| }, | |
| }; | |
| const cats: Movie = { | |
| title: "Cats", | |
| director: "Tom Hooper", | |
| releaseYear: 2019, | |
| boxOffice: { | |
| budget: 95000000, | |
| grossUS: 27166770, | |
| grossWorldwide: 73833348, | |
| }, | |
| }; | |
| function getProfit(movie: Movie): number { | |
| return movie.boxOffice.grossWorldwide - movie.boxOffice.budget | |
| } | |
| getProfit(cats) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment