Skip to content

Commit e7bbcd9

Browse files
committed
se crea funcion maxValue
0 parents  commit e7bbcd9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

maxValue.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const maxValue = (nums) => {
2+
let maximum = -Infinity;
3+
4+
for(let num of nums){
5+
if(num > maximum) maximum = num;
6+
}
7+
8+
return maximum;
9+
};
10+
11+
maxValue([8,2,3,10]) // return 10

0 commit comments

Comments
 (0)