Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TheAlgorithms/JavaScript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: DrxcoDev/JavaScript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Jan 26, 2024

  1. Update Area.js

    DrxcoDev authored Jan 26, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    98e9920 View commit details
Showing with 17 additions and 1 deletion.
  1. +17 −1 Maths/Area.js
18 changes: 17 additions & 1 deletion Maths/Area.js
Original file line number Diff line number Diff line change
@@ -170,6 +170,21 @@ const validateNumericParam = (param, paramName = 'param') => {
}
}

/**
* @function areaRectangleAlt
* @description An alternative method to calculate the area of a rectangle.
* @param {Integer} length - Integer
* @param {Integer} width - Integer
* @return {Integer} - length * width
* @example areaRectangleAlt(4, 5) = 20
*/
const areaRectangleAlt = (length, width) => {
validateNumericParam(length, 'Length')
validateNumericParam(width, 'Width')
return length * width
}


export {
surfaceAreaCube,
surfaceAreaSphere,
@@ -180,5 +195,6 @@ export {
areaTrapezium,
areaCircle,
areaRhombus,
areaTriangleWithAllThreeSides
areaTriangleWithAllThreeSides,
areaRectangleAlt
}