Skip to content

Commit 69c9994

Browse files
committed
new commit
1 parent 575e84e commit 69c9994

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Array/test.js

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

0 commit comments

Comments
 (0)