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

Alex Forseth
Alex Forseth
8,017 Points

What am I doing wrong here?

I am selecting the list elements as the way I understand it from the video. I am unsure why I get the below AST node type error. Someone please look at my code and tell me what I am doing wrong. Thank you.

Bummer! Unexpected AST node type passed to processExpressionStatement method: VariableDeclaration

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 $characterList = $('li:hidden');
$characterList.show();

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hey Alex,

Challenges and the instructions associated with them are very specific and need to be followed exactly. Here the instructions do not say to create a variable or store the value in one, so by doing so, you are confusing the code checker which will always result in a Bummer!.

I did not try your code, but I don't see why that wouldn't work... just not what the checker wants.

Keep Coding! :) :dizzy:

Alex Forseth
Alex Forseth
8,017 Points

Thanks for clarifying. I did not take that into account.

Alex Forseth
Alex Forseth
8,017 Points

So I can see from a previous post that the answer: $( "li:hidden" ).show(); will work.

How ever. I fail to see what is wrong with my original answer where I put the hidden list items into a variable and then just simply called that variable on the next line with the show method attached to it.

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

Any input would be appreciated.