better-dev.com
Learn
Toggle theme
Home
Learn
The TypeScript Handbook: Everyday Types (Part 1)
6. Object Types
Ex. 6.1:
Object Parameters with Optional Properties
Ex. 6.1:
Object Parameters with Optional Properties
Adjust the following function definition as follows:
Accept a
person
object with the fields
name
(string) and
birthYear
(number, optional)
Check the value of
birthYear
for
undefined
before using it in calculations
Solution
Run Tests
Loading...