For this challenge I need to access whatever property is specified as the second argument (pre) of the function, I couldn’t figure out how to do it so I used a map method as a workaround, returning a specific value of an object if the type of its name is a string. It works when I type a.isBot, but not when I type a.pre, even though pre equals the string of "isBot". Why is this happening? Also, if someone could share how to access specific values I would really appreciate it.
All the values at name are strings so I’m getting their values at pre and checking them for truthiness/falsiness. That’s my logic. Again, I’m using this method only because I don’t know of any other way to access values at pre. So why is the function passing for 9 conditions out of 10?
All the values at name are strings so I’m getting their values at pre
This doesn’t make sense. In your function, a is an object. You’re checking two properties on that object when the requirements only ask you to check one.
With the above transformation function, and a pre value of “age”
// this transforms to 39
{
name: 'Bob',
age: 39
}
// this transforms to null (because `a.name` is not a string)
{
age: 39
}
// this transforms to null (because `a.name` is not a string)
{
name: 1234
age: 39
}
Looking at this I don’t know what I’m supposed to expect. All I know is I need to access values at pre and pass them through Boolean(), and fetching them by mapping is the only way I know of.