Challenge 1: Checking Truthiness

Validate what we've learned about truthiness.

We'll cover the following

Problem statement

This exercise is about validating what we’ve learned about truthiness.

Consider the following array:

objects = [true, false, nil, 0, 1, "", []]

Add some code so that it outputs the following table:

object                     | !!object
true                       | [true|false]
false                      | [true|false]
nil                        | [true|false]
0                          | [true|false]
1                          | [true|false]
""                         | [true|false]
[]                         | [true|false]

Note: The last column should be filled in with either true or false, depending on what the !!object operation, which is the same as not not object, returns for each of the objects.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy