-
-
Save Elle0320/503d71826dab75ffc8242b059f1cc341 to your computer and use it in GitHub Desktop.
Challenge #1
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
[ | |
{ "name": "Atreides", "planets": "Calladan" }, | |
{ "name": "Corrino", "planets": ["Kaitan", "Salusa Secundus"] }, | |
{ "name": "Harkonnen", "planets": ["Giedi Prime", "Arrakis"] } | |
] |
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
interface House { | |
... | |
} | |
interface HouseWithID { | |
... | |
} | |
function findHouses(houses: string): HouseWithID[]; | |
function findHouses( | |
houses: string, | |
filter: (house: House) => boolean | |
): HouseWithID[]; | |
function findHouses(houses: House[]): HouseWithID[]; | |
function findHouses( | |
houses: House[], | |
filter: (house: House) => boolean | |
): HouseWithID[]; | |
console.log( | |
findHouses(JSON.stringify(houses), ({ name }) => name === "Atreides") | |
); | |
console.log(findHouses(houses, ({ name }) => name === "Harkonnen")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment