Skip to content

Instantly share code, notes, and snippets.

View saurabhkacholiya's full-sized avatar

Saurabh Ramesh Kacholiya saurabhkacholiya

View GitHub Profile
@saurabhkacholiya
saurabhkacholiya / 1.js
Created February 24, 2021 15:05 — forked from getify/1.js
Converting English number sentences ("one hundred forty two point three") to numeric digits ("142.3")
convert("one hundred five"); // "105"
convert("six hundred and fifty three"); // "653"
convert("zero zero one two three"); // "123"
convert("twelve o three"); // "1203"
convert("thirteen zero nine"); // "1309"
convert("fifteen sixteen"); // "1516"
convert("fourteen ninety two"); // "1492"
convert("nineteen ten"); // "1910"
convert("twenty twenty"); // "2020" <---- ugh!
convert("twenty twenty one"); // "2021" <---- ehhh...