I´m trying to solve an algorithm problem from Codewars that consists in converting letters to numbers
So far I have been able to get here:
console.log(parseInt("one")) // returns [1]
console.log(parseInt("twenty")) // returns [20]
console.log(parseInt("two hundred forty-six")) // returns [ 3, 100, 40, 4 ]
Ok so by now the only thing my code is doing is iterating through this array:
const leyend = [
["one",1],["two",2],["three",3],["four",4],["five",5],["six",6],["seven",7],["eight",8],["nine",9],["ten",10],["twenty",20],["thirty",30],["forty",40],["fifty",50],
["eleven",11],["twelve",12],["thirteen",13],["fourteen",14],["fifteen",15],["sixteen",16],["seventeen",17],["eighteen",18],["nineteen",19],["hundred",100],
["thousand",1000],["-",false],["and",false]
]
And substitute each string for a number. The problem, is i can´t see why if I do this:
console.log(parseInt(“thousand”)) // returns nothing
Wherever in the string there is “thousand” for some strange reason it just does´nt put 1000.
If i put any other number it works. However with “thousand” it does´nt. How this is possible?
Here´s the full code: