JavaScript question

Welcome to the Get Help category!

Hi, I started this project (plating woth javascript) to try out every new concept in the Intro to Javascript that I was doing, finished some minutes ago. The last four lines return with an error I just can-t see. Would you help me? I wouldn-t like to "drag " this issue with me as I move forward. Thanks in advance

https://www.codecademy.com/workspaces/64289e2e5fb07e4e189c87cb

hi
I’m confused. I don’t understand.
I found the bug. The code works on my pc with Visual Studio Code, but on line it always bug with the same message. Try on your pc! I suppose it will work too.
But before, just see the bug on line 6 you write “consol” against “console”.
Regards.

//
// Line 6.
// 
// You wrote:
console.log('blueberries'.toUppercase());

// It should be:
console.log('blueberries'.toUpperCase());

//
// Line 8
//
// You wrote:
consol.log(Math.random() * 50);

// It should be:
console.log(Math.random() * 50);

Thanks! Will do!
Cheers!

Thanks ! I’ll try the changes!
Cheers

thumbnail_IMG_2590
I could use some help. I keep getting undefined. Any suggestions to why?
Thank you.
Chris

You may want to start a new thread so that your question/issue is more visible and not buried in another thread.

You have declared and initialized a list/array deansList inside the function getDeansList, and you are pushing elements into the array. But, you aren’t explicitly returning anything from the function.

A function without an explicit return statement returns undefined.

Including an explicit return function should get rid of undefined being printed. That being said, there are other issues with your solution. If I am not mistaken, this is an exam question. So, I will try to not elaborate too much on the solution.

But you may want to reflect on:

  • how you you are intializing the deansList array,

  • the distinction between argument and parameter, and what should be used in the body of a function,

  • Are you meeting the following specification?

Complete the code below so that the getDeansList() function accepts a list of student objects, and returns an array of the student names who are on the Dean’s List based on their GPA of 3.5 or higher."

First, sort out the undefined issue. Then you will be able to see the output you are getting. From there on, you will have to think about the above issues to figure out how you may need to change your solution.

Thank you for you help!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.