Meal maker JavaScript Project

If anyone has the answer to this, id be really happy to get some help. I’m simply wondering, why within the generateRandomMeal() method, when we need to calculate the total price, we don’t need to use “this.” when accesing the price property(i.e. appetizer.price and not appetizer.this.price)? I thought that in order to access any property within a method, we needed to use “this”.
Thank you !

Please see this topic:

[How-to] Create a topic that everyone will read

Having the code and exercise url would make it a lot easier to answer your question

within your generateRandomMeal function, you call getRandomDishFromCourse(), right? The result of these calls you store in local variable (appetizer for example). Given these variable have a local scope within your method, we can access them directly. They are not properties of the object which would required this

that makes sense.thanks a lot!!!

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