Ticket Time explainer

Hey there, the puzzle is importing an array named studentList. Your function has a parameter named studentlist. Let’s change this parameter’s name to list, so we don’t confuse the two.

Right now, your function’s for loop is looping directly through the imported array studentList, and ignoring the parameter.

While that gives us the right output for this puzzle, what if you wanted to loop through a different array? Your function is hardcoded to loop through this one specific array, and so it wouldn’t work for any other array.

First, change the name of the parameter to list so it’s not confusing. Then, change the for loop to for (var element of list)

Hope this helps!
Ben

1 Like

Hello Ben, How do I solve this issue of the age and 12 bracket thing ?

image

The site will not permit me to put square brackets inside the console.log parentheses. Is that because my code is incorrect elsewhere?

@Aijuka_Shawn @Benjamin_Spicer

Hey there, there can be some weird app behavior sometimes with the square brackets.

Where the code gets placed depends on what is highlighted when you add code with the code keyboard.

For example, in your screenshot @Benjamin_Spicer, tap element to highlight it, then tap the brackets. That should add the brackets to the end of element, instead of at the end of the console.log()

For you, @Aijuka_Shawn, it’s a little trickier. Try tapping/clicking right where between the t in element and the [. This way all of element['age'] gets highlighted. Then add the >.

Hope this helps! Let me know if you have any issues.
Ben

Please what happens if I use studentList in the function

Hi Ben can you please help. I am failing to change Console.log(element) [‘name’] to console.log(element[‘name’

You did it, now you need to call the needsAdultTicket function using studentList as an argument at the bottom of the code.

A post was merged into an existing topic: The Longest Word explainer

Hi what I’m doing wrong here ?

image
It isw not working plz hlp me

Hi guys!!

I was in the same as you, thinking why is allways Asking of the function call, even when already inside the code. Realizing that i thought, what if i put the call outside of the maim code?!

Well, it Works!

Here comes the printscreen!

Best regards!!

Doing this exactly as says yet cannot get by this error


What’s wrong in this code the output is right?

I think that you should change studentList in the ‘for’ statement to list otherwise you are calling the array studentList every time and the function will not work on any other imput

that code doesnt work. i can not to continue

now i can see my mistake, i was written the call function in a wrong place

Hello, I have tried everything but still can’t get the code to work. Kindly help out!
Screenshot_20210224-221501|236x500

doesnt use studenlist just student

bueno ya avance y aqui no sigue ayuda! :ok_hand:

ya lo solucione xD observen bien

Your console.log should be like this: console.log(element[‘name’] not console.log(needAdultTicket(studentLis)). The needAdultTicket(studentList) need to be at the last place away from the {} function brackets. Here is an image so you can see what it looks like. Hope this helps!