Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions firstToyProblem.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**
* [1,10,5,-3,100]
* create a function that finds the minimum
* without using any pre build in function
*/

function minimum(array) {
return;
let min = array[0];
for (let i = 0; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
}
}
return min;
}
Empty file removed hey.txt
Empty file.
16 changes: 16 additions & 0 deletions sumOfPairNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* write a function that returns the sum of the pair numbers inside an array
*
* exple sumPair([1,6,100,346,761,249])=>452
*
* sumPair([2,4,9,73])=>6
*/
function sumPair(array) {
let sum = 0;
for (let i = 0; i < array.length; i++) {
if (array[i] % 2 === 0) {
sum += array[i];
}
}
return sum;
}