Tell us what’s happening:
I just check the console.log output with my code in jsbin and it shows the output is correct
I dont know what is wrong with it.
Your code so far
function equilibrium (a) {
var lower = 0;
var higher = 0;
var output = [];
for(let i = 0; i<a.length; i++){
for(let j = 0; j<i; j++){
higher += a[j];
}
for(let k = i+1; k<a.length; k++){
lower += a[k];
}
if(higher == lower){
output.push(i);
}
lower = 0;
higher = 0;
}
return output;
}
equilibrium([-7, 1, 5, 2, -4, 3, 0])
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge: