How do i know when is something true?
For sex we have male-famale
For age - number
For single we have yes-no
…
Does here we just need to look at test examples at left side, and make “constant” test, or here is hiding some other magic?
How do i know when is something true?
For sex we have male-famale
For age - number
For single we have yes-no
…
Does here we just need to look at test examples at left side, and make “constant” test, or here is hiding some other magic?
Something is true if the objects hold value for it. For example sex: male is true. Its not true when the objects dont have a sex|age|single etc or if those variables hold NaN, undefined, null, 0 etc.
Good luck
In JavaScript, all values are ‘truthy’ unless they are defined as ‘falsy’. Falsy values are:
false
0
""
null
undefined
NaN
Everything else - numbers, strings, etc. - is truthy. To test if a value is truthy, write:
if (value) truthy = true;
see also: https://developer.mozilla.org/en-US/docs/Glossary/Truthy
We’re testing for two things: do all the objects in the collection
array have the property pre
? and if they do all have that property does that property have a value other than one of those listed by @lincore?
So in the conceit of the problem. Are they telling the truth about having a sex property? and if they do, are they telling the truth about having a value in that sex property?
How do i know when is something true?
Remember Falsy Bouncer? That same logic will work.
How do i know when is something true?
For sex we have male-famale
For age - number
For single we have yes-no
The properties don’t have to be sensible. "sex": "elephant"
may not make any sense, but it is truthy.
Does here we just need to look at test examples at left side, and make “constant” test, or here is hiding some other magic?
The answer is never going to be just hardcoding anwers to trick the tests.