Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 96d873e

Browse files
biggest number of an array
1 parent 3b4fb99 commit 96d873e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@
3939
| Problem - 35 | [A needla in haystack](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-35.js) |
4040
| Problem - 36 | [Rock Paper Scissors](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-36.js) |
4141
| Problem - 37 | [sum of an array](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-37.js) |
42+
| Problem - 38 | [biggest number of an array](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-38.js) |
4243

43-
<!-- | Problem - 38 | | -->
44+
<!-- | Problem - 39 | | -->

‎problem-38.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Say you are given the following array of integer data type.
2+
// Now write a program which will find the biggest integer and print the integer
3+
4+
5+
const solution = (array) => {
6+
let array1 = array.sort(function(a,b){return a - b})
7+
let biggest = array1[array1.length -1];
8+
return biggest;
9+
};
10+
11+
console.log(solution([10, 20, 30, 40, 50])); // 50
12+
console.log(solution([5, 10, 15, 20, 25, 30])); // 30
13+
console.log(solution([44, 665, 221, -434, 643, 123])); // 665
14+
console.log(solution([-34, 64, -1, 0, 45])); // 64

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /