Created
February 16, 2022 23:18
-
-
Save goodanthony/7e2b3a68467f4c16be4876e8f3250780 to your computer and use it in GitHub Desktop.
Code assessment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ArrayChallenge = (arr) => { | |
const result = arr.reduce((acc, curr) => { | |
return acc + curr; | |
}, 0); | |
const double = result * 2; | |
const check = arr.some(e => { | |
return double > e * 2; | |
}); | |
return check ? "true" : "false"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
def array_challenge(arr)
arr.each do |x|
arr.each do |y|
if x * y > arr.reduce(:+) * 2
return "true"
end
end
end
"false"
end``