4. Must be written in Javascript [Problem Description] You are given an array of numbers arr. Among these, the function
Posted: Fri Jul 01, 2022 5:39 am
4.Must be written in Javascript
[Problem Description]
You are given an array of numbers arr. Among these, thefunction that finds the value closest to 0 'Number, please completethe solution.
[Input format]
- arr is an array of length 1 or more and 100 or less.
- The elements of arr are integers between 0 and 100.
[Output Format]
- Returns the closest value to 0.
//
function solution(arr) {
var answer = 0;
return answer;
}
//
[Problem Description]
You are given an array of numbers arr. Among these, thefunction that finds the value closest to 0 'Number, please completethe solution.
[Input format]
- arr is an array of length 1 or more and 100 or less.
- The elements of arr are integers between 0 and 100.
[Output Format]
- Returns the closest value to 0.
//
function solution(arr) {
var answer = 0;
return answer;
}
//