Trying to use object method to calculate volume of a rectangular prism | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Trying to use object method to calculate volume of a rectangular prism

https://code.sololearn.com/cMx9eVd6EInd/?ref=app

27th Feb 2023, 10:57 AM
A Mohammed Alhaan
A Mohammed Alhaan - avatar
1 Réponse
+ 4
var cuboid = { length: 25, width: 50, height: 200, volume: function() { return this.length * this.width * this.height; } //volume: vol(length ,width ,height ); }; console.log(cuboid.volume()) /*console.log(cuboid.length*cuboid.width*cuboid.height) */
27th Feb 2023, 11:23 AM
A͢J
A͢J - avatar