---
title: "Comment by Tobbe Lundberg on \"Code I did for Codewars...\" | Hashnode"
description: "I saw this, and had to try it myself Here&#39;s another way to do it. Probably worse than your solution. But I wanted to make it a chain of function calls funct"
url: "https://hashnode.com/posts/code-i-did-for-codewars/616eb6bc41c1b75f924d907a/comment/616f1da7f1f4c944cc6b56f1"
---

[Discussion](https://hashnode.com/posts/code-i-did-for-codewars/616eb6bc41c1b75f924d907a)

Comment [Code I did for Codewars...](https://hashnode.com/posts/code-i-did-for-codewars/616eb6bc41c1b75f924d907a)

[Tobbe Lundberg](https://hashnode.com/@tobbe)

[Oct 19, 2021](https://hashnode.com/posts/code-i-did-for-codewars/616eb6bc41c1b75f924d907a/comment/616f1da7f1f4c944cc6b56f1)

I saw this, and had to try it myself

Here's another way to do it. Probably worse than your solution. But I wanted to make it a chain of function calls

```
function sumTwoSmallestNumbers(numbers) {
  return (numbers.sort((a, b) => a - b))
    .slice(0, 2)
    .reduce((prev, cur) => prev + cur)
}
```

[Joe McGee](https://hashnode.com/@joemcgee4151986)

[Oct 20, 2021](https://hashnode.com/posts/code-i-did-for-codewars/616eb6bc41c1b75f924d907a/comment/616f1da7f1f4c944cc6b56f1#reply-617007d3d78c655a23127fc7)

interesting use of the .slice method. I would have never thought of that.
