+ 1

What I'm doing wrong?

This is my js practice. Could you help me? https://code.sololearn.com/Wz3v8d3xrCAt/?ref=app

30th Jul 2021, 7:34 PM
Gabriel Ferreyra
Gabriel Ferreyra - avatar
4 Respuestas
+ 3
Your object ends at } also typo with height
30th Jul 2021, 8:11 PM
Oma Falk
Oma Falk - avatar
+ 3
Gabriel Ferreyra var cuboid = { length: 25, width: 50, height: 200, calcular:function (){ var cuboide = this.length*this.width*this.height; return cuboide } };
30th Jul 2021, 8:13 PM
Abhay
Abhay - avatar
+ 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 }
30th Jul 2021, 7:43 PM
Abhay
Abhay - avatar
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
30th Jul 2021, 7:51 PM
Gabriel Ferreyra
Gabriel Ferreyra - avatar