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 11// https://projecteuler.net/problem=3
2- const problem = 600851475143
32
4- const largestPrime = ( num ) => {
3+ export const largestPrime = ( num = 600851475143 ) => {
54 let newnumm = num
65 let largestFact = 0
76 let counter = 2
@@ -17,4 +16,3 @@ const largestPrime = (num) => {
1716 }
1817 return largestFact
1918}
20- console . log ( largestPrime ( problem ) )
Original file line number Diff line number Diff line change 44 * for the target value until a match is found or until all the elements
55 * have been searched.
66 */
7- function SearchArray ( searchNum , ar ) {
7+ function SearchArray ( searchNum , ar , output = v => console . log ( v ) ) {
88 const position = Search ( ar , searchNum )
99 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' )
1314 }
1415}
1516
You can’t perform that action at this time.
0 commit comments