Here I have tried a different approach to this problem.
Taking sheep1 array as reference.
let noOfTrueValues = sheep1.length - sheep1.indexOf(true);
So many different solutions, I love it!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.