DEV Community

Discussion on: Let's Count Some Sheep!

Collapse
 
jasmin profile image
Jasmin Virdi • Edited

Here I have tried a different approach to this problem.
Taking sheep1 array as reference.

sheep1.sort();
let noOfTrueValues = sheep1.length - sheep1.indexOf(true);

Collapse
 
michellekaplan7 profile image
Michelle Kaplan • Edited

So many different solutions, I love it!