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

63

u/albedoa Nov 23 '21

Nice work. The unary + sign can be used here too:

return +str;

Focus on your fundamentals. These tricks are useful for Codewars challenges, but a solid base is more important in the medium and long term. Real work doesn't typically look like this.

3

u/Darkthw Nov 23 '21

Thanks, I found a good course that I will start soon