@sanmigueldev/suma-module
Version:
Módulo simple para sumar números
92 lines (59 loc) • 2.15 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>sum.js - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-Math.html">Math</a><ul class='methods'><li data-type='method'><a href="module-Math.html#.sum">sum</a></li></ul></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-getting-started.html">Getting Started</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">sum.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* Módulo para operaciones matemáticas básicas
* @module Math
*/
/**
* Suma dos o más números
* @param {...number} numbers - Números a sumar
* @returns {number} La suma de todos los números
* @example
* // Retorna 8
* sum(3, 5);
* @example
* // Retorna 15
* sum(1, 2, 3, 4, 5);
*/
export function sum(...numbers) {
return numbers.reduce((total, num) => total + num, 0);
}
</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>