We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
consterrorMessage='Illegalrectangledimensions';functioncheckDimensions(length,width){if(length>=1&&length<=1000&&width>=1&&width<=1000){return{length:Number(parseFloat(length).toFixed(3)),width:Number(parseFloat(width).toFixed(3)),};}returnfalse;}functiongetArea(length,width){letarea;// Write your code hereif(checkDimensions(length,width)){leti2D=checkDimensions(length,width);area=i2D.length*i2D.width;returnarea;}returnerrorMessage;}functiongetPerimeter(length,width){letperimeter;// Write your code hereif(checkDimensions(length,width)){leti2D=checkDimensions(length,width);perimeter=2*(i2D.length+i2D.width);returnperimeter;}returnerrorMessage;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Arithmetic Operators
You are viewing a single comment's thread. Return to all comments →