Skip to content

Commit 1c0bd37

Browse files
committed
add arrayValuesGreaterThanY function
1 parent 98cbb94 commit 1c0bd37

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

dookieBreathe.test

Whitespace-only changes.

greaterthanY.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function arrayValuesGreaterThanY(inputArray, threshold) {
2+
var count = 0;
3+
for(i=0; i<inputArray.length; i++){
4+
if(inputArray[i] > threshold){
5+
count++;
6+
}
7+
}
8+
console.log("There were", count+"values greater than, ",threshold +" in the array.")
9+
}
10+
11+
var test = [21, 3, 5, 6, 9, 11, 44, 45];
12+
var threshold = 6;
13+
14+
arrayValuesGreaterThatY(test,threshold);

odd.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
function printoddnum() {
1+
2+
function createOddArray1to255() {
3+
var y = [];
24
for (var i = 1; i <= 255; i++) {
3-
if (i % 2 === 1){
4-
console.log(i)
5+
if(i%2 === 1) {
6+
//I could push this
7+
// y.push(i);
8+
//y[i] = i;
9+
y[y.length] = i;
510
}
611
}
12+
return y;
713
}
14+
console.log("My function returned:",createOddArray1to255());

0 commit comments

Comments
 (0)