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

Size

The size of an Openmadness array is simply the total number of elements it contains. It's the grand count of all the individual numbers, regardless of how they're organized into dimensions. You can find the size using the size property.

import om from 'openmadness';

const temperatures = om.array([25, 28, 22, 27, 26]);
console. log("Temperatures:", temperatures.data);
console.log("Shape of temperatures:", temperatures.shape); // Output: [5]
console.log("Size of temperatures:", temperatures.size); // Output: 5

const productMatrix = om.array([
    [10, 20],
    [30, 40],
    [50, 60]
]);
console.log("\nProduct Matrix:\n", productMatrix.data);
console.log("Shape of Product Matrix:", productMatrix.shape); // Output: [3, 2] (3 rows, 2 columns)
console.log("Size of Product Matrix:", productMatrix.size); // Output: 6 (3 * 2 = 6 total elements)
Edit this page on GitHub
Last Updated:: 7/11/25, 12:24 PM
Contributors: Dev-Liz
Prev
Shapes
Next
Axes