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

11

u/Loud_Type_1756 Nov 23 '21

I am a newbie and totally unable to grasp this solution. 😔

23

u/programmingacctwork Nov 23 '21

I think it's because Javascript is coercing it to a Number when they're using an operator on it. It's a weird solution to be honest.

11

u/Darkthw Nov 23 '21

Yep 😂, none of the other solutions look like this, I'm just happy I was able to do it by myself even this it is not the best way to go about it, I've learned other ways now