0
I’m trying to pass a challenge and I’m having a hard time getting through the following topics:
Write a function called
createCars
which will receive three arguments: name, stars and brand. This function must return an object. The object that returns must have properties that are also called name, year and brand. The values assigned to these properties must be the values that are passed to the function. In addition, the object thatcreateCars
returns must have two methods:hasMorestrelasThan
- a function that accepts a "name" object as a parameter and returns true if the name has more "stars" than the one that is passed to it as an argument, and false otherwise.sayMarca
- a function that records the value of the "tag" property of the "name" object for the console.
What I have for this first step:
function createCar(nome, estrelas, marca) {
myObject.nome = "nome";
myObject.estrelas = "estrelas";
myObject.marca= "marca";
retun Object
}
I am a complete beginner and am trying to learn on my own. If anyone can help, I will be eternally grateful!
Welcome to Sopt. Take a look at tour for more information on how the site works. Please inform us about the specific difficulty, the error that occurs, where it occurs, etc. :)
– Ronaldo Araújo Alves