Solution: Interfaces, Classes, Inheritance, and Modules
Review the solutions to the challenges discussed in the previous lesson.
Solution: Using an interface
The hasProperty
function takes two arguments:
obj
, which represents the object of typeUser
.prop
, which is the string representing the property to check for.
Inside the hasProperty
function, we use the in
operator to check if the given prop
...