Skip to content

Commit 98e9920

Browse files
authored
Update Area.js
1 parent 069803f commit 98e9920

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Maths/Area.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,21 @@ const validateNumericParam = (param, paramName = 'param') => {
170170
}
171171
}
172172

173+
/**
174+
* @function areaRectangleAlt
175+
* @description An alternative method to calculate the area of a rectangle.
176+
* @param {Integer} length - Integer
177+
* @param {Integer} width - Integer
178+
* @return {Integer} - length * width
179+
* @example areaRectangleAlt(4, 5) = 20
180+
*/
181+
const areaRectangleAlt = (length, width) => {
182+
validateNumericParam(length, 'Length')
183+
validateNumericParam(width, 'Width')
184+
return length * width
185+
}
186+
187+
173188
export {
174189
surfaceAreaCube,
175190
surfaceAreaSphere,
@@ -180,5 +195,6 @@ export {
180195
areaTrapezium,
181196
areaCircle,
182197
areaRhombus,
183-
areaTriangleWithAllThreeSides
198+
areaTriangleWithAllThreeSides,
199+
areaRectangleAlt
184200
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy