Random Dish Project "Property PUSH error"

Hello it’s me again…

I am having some trouble fixing this error that I am getting at line 34. I did some research and it says that push doesn’t work on unidentified objects, push work on arrays. _courses it’s composed by properties that are arrays why is push not accepting them as that?

Here is the link to my code, thank you for your help.

Random dish project

If you have an error message saying that something is undefined, then you would need to consider whether you think that something should be defined, and if so, go fix the code that should have defined it, or, maybe you meant something else, in which case, refer to that something else instead of something that doesn’t exist.


console.log(x)  // x is not defined ... so don't use it. or define it

Found my error, just did.

I was giving the wrong data to my parameters.

The error message is worth understanding, if you look closer at it, it says that you’re doing:


What you were looking for was a method of array, you never called it so it wasn’t “not accepting” anything.

And, “push” isn’t something that exists globally, what you specifically mean is a property of array objects. Whenever you use array’s push you are first obtaining the push method, and once you’ve obtained it you can call it.

…and when you’re calling it as a method of some object, push’s this will refer to the object you’re calling it on