Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
Home
Getting Started
  • Fundamentals
  • Advanced
  • Fundamentals
  • Intermediate
  • Advanced
OM-Functions
  • FAQs
  • Glossary
  • Contributing
Changelog
Github
  • Tutorials

    • Fundamentals

      • Basic Arithmetic
      • Data Types
      • Introduction to Array
      • Shapes
      • Size
      • Axes
      • Statistics
      • Logic
    • Advanced

      • 2D Array
      • 3D Array
      • Algebra
      • Average
      • Variance

Statistics

Minimum and Maximum Values

Openmadness provides simple methods to quickly find the extreme values in your dataset: the smallest number using min() and the largest using max(). This helps you quickly see how high and low your numbers go.

  • min() Get the lowest value in your Openmadness array.
  • max() Get the highest value in your Openmadness array.
import om from 'openmadness';

const stockPrices = om.array([120.50, 122.10, 119.80, 125.00, 121.75]);
console.log("Stock Prices:", stockPrices.data);

const lowestPrice = stockPrices.min();
console.log("Lowest price:", lowestPrice); // Output: 119.8

const highestPrice = stockPrices.max();
console.log("Highest price:", highestPrice); // Output: 125

sum()

Calculate the total sum of all numbers in your array. We saw this earlier with axes, but here's a simple example.

import om from 'openmadness';

const monthlyExpenses = om.array([300, 150, 75, 200, 120]);
console.log("Monthly Expenses:", monthlyExpenses.data);

const totalExpenses = monthlyExpenses.sum();
console.log("Total Monthly Expenses:", totalExpenses); // Output: 845

Edit this page on GitHub
Last Updated:: 7/2/25, 12:46 PM
Contributors: Dev-Liz
Prev
Axes
Next
Logic