|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
475 bytes
|
| Line | |
|---|
| 1 | function min(items) {
|
|---|
| 2 | if (!items || items.length === 0) {
|
|---|
| 3 | return undefined;
|
|---|
| 4 | }
|
|---|
| 5 | let minResult = undefined;
|
|---|
| 6 | for (let i = 0; i < items.length; i++) {
|
|---|
| 7 | const current = items[i];
|
|---|
| 8 | if (current == null || Number.isNaN(current) || typeof current === 'symbol') {
|
|---|
| 9 | continue;
|
|---|
| 10 | }
|
|---|
| 11 | if (minResult === undefined || current < minResult) {
|
|---|
| 12 | minResult = current;
|
|---|
| 13 | }
|
|---|
| 14 | }
|
|---|
| 15 | return minResult;
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | export { min };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.