Ayah's Students explainer

the solution is not working. I have read some of the comment and have tried many things over the last 4 days. I’m very frustrated. Can you help me out.

Hey there,

It doesn’t look like the function is being called. Try calling it on the last line of code, outside the function declaration, like this:

needsAdultTicket(studentList)

Hope this helps!
Ben

this worked fine as is

Hey there, change the parameter of the function to list instead of studentList, then use that parameter in the for loop, like this:

function needsAdultTicket(list) {
    for (var element of list) {
        ...
    }
}

Hope this helps!
Ben

1 Like

I need help with my puzzle

It doesn’t let me write element in the parts that it is needed, but there is no element option to add it in anyway.

Hey there, when you create a for loop in Grasshopper, it will automatically fill it in with a looping variable named element, like this:

for (var element of ___) {

}

A key named element will then be added to the code keyboard.

You can double tap/click on element if you’d like to change its name.

Hope this helps!
Ben

Have you tried clicking through on the ‘Guide’ function at the top of the page? I find the guide useful in terms of how easy it is to access, and how succinct and clear the explanations and examples are.

Although I relate to what you are saying. pdf Cheatsheets might be an idea? What do you think, @Grasshopper_Ben

Can’t find “guide”. Anyway, the thing is sometimes the explainer is too clear, and practically gives you the answer. Reviewing past lessons may allow you to come up with a solution on your own, and if you still can’t and need a bit more help, you go to the explainer.

1 Like

See the button above the code window for ‘Guide’ - although I am on a PC, so the view may be different for you on mobile?

I know what you mean about the explainer over-explaining. But we have the option to try and solve the puzzle before we click through. And the hints are pretty good if you get it wrong, so you can learn a lot through making a few attempts. Then, if all else fails, you can read the walk-through and last of all reveal the code.

Plus, where else online are intructors and students discussing basic puzzles?!

1 Like

Oh, I definitely love Grasshopper. I don’t mind the explanations at all. On the contrary, I took programing in school and I could never solve anything right. Now, I’ve gone through the whole app twice, and learned a new thing every time.
And yes, the app is different on the PC. I think I’ll try another round in mine.

3 Likes

I can’t figure out why I can’t change my if statement from [‘age’>12] to [‘age’] >12

I finally got it don’t know why it was so difficult

I don’t know what I am doing wrong.

Nevermind!:sweat_smile::wink:!!! I JUST found out what me did wrong.

1 Like

Looks like there’s an extra whitespace in your property name. Try changing 'name ' to 'name'.

Hope this helps!
Ben

1 Like

Blockquote

I don’t get it I thought I was doing it right.

2 Likes

Hi, you have a typo. Try typing studentList instead of studentlist.
Then, call the function.
That should help.

1 Like

Try doing needsAdultTicket(studentList); instead of console.log(needsAdultTicket(studentList));.