Skip to content

Commit a9f2eea

Browse files
committed
new algorithms
1 parent 1c0bd37 commit a9f2eea

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

maxMinAvg.js

Whitespace-only changes.

noNegativeNumber.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function noNegativeNumber(x) {
2+
for(i=0;i<x.length;i++) {
3+
if(x[i] < 0){
4+
x[i] = 0
5+
}
6+
}
7+
return x;
8+
}
9+
10+
var x = [1,5,10,-2, -4, -10,9,-1000]
11+
noNegativeNumber(x);

squarevaluesinanarray

Whitespace-only changes.

squarevaluesinanarray.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function squareTheValuesInAnArray(x) {
2+
for(i=0;i<x.length;i++) {
3+
x[i] *= x[i];
4+
}
5+
return x;
6+
7+
}
8+
9+
var x = [1,5,10,-2]
10+
11+
squareTheValuesInAnArray(x);

0 commit comments

Comments
 (0)