Great. You can do this in a single line of code, but that is a little harder to read.
const result = '1bn22vg4n62'.match(/\d+/g).reduce((acc,e)=>acc+parseInt(e),0); console.log(result) // 89
Great. That can be done. 👌👌 but they are 2 lines.😉😁✌
haha 😊
yes I'd have done the same and no, I don't believe this is harder to read than the posted code :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great.
You can do this in a single line of code, but that is a little harder to read.
Great. That can be done. 👌👌
but they are 2 lines.😉😁✌
haha 😊
yes I'd have done the same and no, I don't believe this is harder to read than the posted code :)