File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
1
// https://projecteuler.net/problem=3
2
- const problem = 600851475143
3
2
4
- const largestPrime = ( num ) => {
3
+ export const largestPrime = ( num = 600851475143 ) => {
5
4
let newnumm = num
6
5
let largestFact = 0
7
6
let counter = 2
@@ -17,4 +16,3 @@ const largestPrime = (num) => {
17
16
}
18
17
return largestFact
19
18
}
20
- console . log ( largestPrime ( problem ) )
Original file line number Diff line number Diff line change 4
4
* for the target value until a match is found or until all the elements
5
5
* have been searched.
6
6
*/
7
- function SearchArray ( searchNum , ar ) {
7
+ function SearchArray ( searchNum , ar , output = v => console . log ( v ) ) {
8
8
const position = Search ( ar , searchNum )
9
9
if ( position !== - 1 ) {
10
- console . log ( 'The element was found at ' + ( position + 1 ) )
11
- } else {
12
- console . log ( 'The element not found' )
10
+ output ( 'The element was found at ' + ( position + 1 ) )
11
+ }
12
+ else {
13
+ output ( 'The element not found' )
13
14
}
14
15
}
15
16
You can’t perform that action at this time.
0 commit comments