Create an Object with Conditional Properties
Write a function
-
-
Do not just assign parameters directly—use logic to set
makeUser
that takes two parameters, name
and age
, and returns an object with the following properties:-
name
(always included)-
isAdult
(true if age
is 18 or above, false otherwise)Do not just assign parameters directly—use logic to set
isAdult
.
JavaScript
Console