+ 1
What I'm doing wrong?
This is my js practice. Could you help me? https://code.sololearn.com/Wz3v8d3xrCAt/?ref=app
4 Answers
+ 3
Your object ends at }
also typo with height
+ 3
Gabriel Ferreyra
var cuboid = {
length: 25,
width: 50,
height: 200,
calcular:function (){
var cuboide = this.length*this.width*this.height;
return cuboide
}
};
+ 1
cuboid object has no function calcular , either define it inside object cuboid or you can also add it outside of the object the following way,
cuboid.calcular = function (){
var cuboide = this.length*this.width*this.height;
return cuboide
}
0
Thank you, I understand your correction for the outside way.
But, when it's defined inside the object how I need to write it?
I still don't understand that part. Abhay