0
I need to return on the screen the three values below each other and not on each other’s side. I searched a lot, but did not find break values as a subject in the javascript documentation. Follows Code below:
function plusMinus(arr) {
// Write your code here
let len = arr.length;
let positiveCount = 0;
let negativoCount = 0;
let zeroCount = 0;
for (let i = 0; i < len; i++) {
if (arr[i] > 0) {
positiveCount++;
}
else if (arr[i] < 0) {
negativoCount++;
}
else if (arr[i] == 0) {
zeroCount++;
}
}
return console.log ((positiveCount / arr.length).toFixed(6), (negativoCount / arr.length).toFixed(6), (zeroCount / arr.length).toFixed(6));
}
You can teach me how to format these values?
Here at Stack Overflow you say thank you by voting on the posts. See: How to say thank you in replies?. If one of the answers below solved your problem and there was no doubt left, choose the one you liked the most and mark it as correct/accepted by clicking on the " " that is next to it, which also marks your question as solved. Behold: How and why to accept an answer?
– Augusto Vasques