Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Sorry, whrere should I put it? Thx!
absolutely love it :)
var nums is a converted numbers(string) argument to an array by applying .split(), then .map() method returns a new array of 0s ans 1s;
var sum is the sum of all elements in "nums" array.
var target is being assigned to 0, or 1, as we know that nums contain ony 0s and 1s, if the sum is greater than 1, it means that majority of numbers were odd, otherwise even.
return statement is a beauty, because we search for an index of element with value 0, or 1, which is unique in 'nums' array.