Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript jQuery Basics Working with jQuery Collections Working with jQuery-Specific Selectors

Why does activity say "Unexpected AST node type passed to processExpressionStatement method: VariableDeclaration"?

The two hidden list items are showing and the div remains hidden. The preview shows the activity has been resolved. See code attached. Any help is appreciated.

index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Document</title>
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
    <h2>Star Trek Characters</h2>

    <ul class="character-list">
        <li>Captain Jean Luc Picard</li>
        <li>Data</li>
        <li>Warf</li>
        <li>Dr. Crusher</li>
    </ul>

    <div>I am supposed to stay hidden!</div>    

    <script
    src="jquery-3.2.1.min.js"></script>
    <script src="app.js"></script>
</body>
</html>
app.js
const $hidden = $('li:hidden');
$hidden.show();

8 Answers

Steven Parker
Steven Parker
231,261 Points

Your selector is good, and you can pass the challenge if you avoid the intermediate variable:

$('li:hidden').show();

But in theory, your version should work as-is. You might want to report this as a bug to the Support folks.

Treasure Porth This should be fixed. Why is this taught this way if the test says the way it was taught is wrong?

Thanks Steven. I followed the example from the previous activity and arrived at:

const $hidden = $('li:hidden'); $hidden.show();

I will report the bug.

Support informed me this is not a bug and the activity does work correctly with the right answer. I was able to satisfy the task with $('li:hidden').show();

Thank you for your help

Steven Parker
Steven Parker
231,261 Points

I guess they're being very particular about what constitutes the "right" answer!
Your original one would certainly have worked in a practical situation.

Ricki Barnes
Ricki Barnes
2,553 Points

Same for me as well, though this was the first hit that came up when I googled the error, so I guess it was pretty easy to resolve at least?

I had this issue too.

Anthony Kimberly
Anthony Kimberly
11,049 Points

April 2021 and I'm still having this issue. Could someone in the know come in here and tell us why this isn't a bug?

This should work:

const $hidden = $('li:hidden');
$hidden.show();
Steven Parker
Steven Parker
231,261 Points

It does work, as you can see in the preview. But apparently the bug in the evaluator still hasn't been fixed. You might want to report it again.

I had the same issue here. The very previous video had Treasure writing code in the exact same format to hide odd anchor tag elements. I copied that format and it failed and I don't know why. I can try the version mentioned above but odd to include it as an example in the previous video.