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.
You can just return an object without parenthesis ()
const listSquared = (m, n) => {
let list = [];
for (let i = m; i <= n; i++) {
let divisors = [];
for (let k = 1; k <= i; k++) {
i % k === 0 ? divisors.push(k) : divisors;
}
let sqrt = Math.sqrt(
divisors.reduce((prev, curr) => {
return prev + Math.pow(curr, 2);
}, 0)
);
if (Math.floor(sqrt) === sqrt) {
list.push([i, Math.pow(sqrt,2)]);
}
}
return list;
};
It will be better if you divide the code into parts, book https://refactor-like-a-superhero.vercel.app/
you told already what i was thinking to say. well done. 👏
No longer an issue.
Fixed, please approve!
https://www.codewars.com/kumite/638743d608488f22b0fe704e?sel=638743d608488f22b0fe704e
yes, your solution is better
XD
Can someone please explain this problem? Surprised there is 0 comments in all the solutions as I completely don't understand the question nor answer
yes same here
Could somebody explain, why does it fail when the first element is a string?
This comment is hidden because it contains spoiler information about the solution
Man, I tried to do this but failed...
Nice, first time I encounter
Math.hypot
!Wrong, your posts here are visible in the homepage when not marked as spoilers. There is no need to mark them all either, only when needed.
Loading more items...