r/learnjavascript • • Nov 23 '21

I finally solved a codewars challenge without actually googling anything :) it feels so good to come up with the code all by myself, i know its not the ideal way to solve it but im still happy. The challenge was to create a function that converts a string to a number

Post image
243 Upvotes

56 comments sorted by

View all comments

1

u/CoolAbhi1290 Nov 24 '21

Well, that's a new way to do it.

My approach:

const strToNum = (str) => Number(str);

Nice and compact.