Need help with step 65 of TODO project

hallo.
i think my answer could be correct, but it was falsh
i don’t know where is error.
colud you give me a advice?

my answer is
if(taskData.length > 0){updateTaskContainer()};

Hello, your answer is not wrong, but the lesson wants you to write this more concisely. You can simplify your if condition.

For example, if I want to check if my variable is not false:

// Long way
if (variable !== false) {
  // Code here
};

// Short way
if (variable) {
  // Code here
};

thank you for yout reply.
stii i have a problem yet.

after i wrote your code, code camp said still " You should create an if statement with (taskData.length) as the condition. As a reminder, 0 is a falsy value." because i can not go next page.

Please show us your new code so we can help you

You can post code like this

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

thank you so much!

my code is

if (taskData !== 0) {
  updateTaskContainer()
};

The goal of the lesson is to teach you about checking for falsey values.

the directions say

Because 0 is a falsy value all you need for the condition is the array length.

The lesson only wants you to have the array length

Without giving away the answer, here is another way to look at it.

The length of the array will be a number

If that array length is zero, then that is falsey which will be false in an if statement.
If that array length is greater then zero, then that would be truthy, it would be true in an if statement.

1 Like

Also, the hint gives you the answer here

I have created an issue to provide a code example since this lesson wants a specific answer just checking for the length

1 Like

thank you so much.
finally i understood!!

1 Like