Solution: lb_spellit

JavaScript·2 min read·Sep 19, 2025

Here is the commented solution for this project.

Create the script

Create a file named lb_spellit.js.

$ touch lb_spellit.js

Convert numbers up to hundreds

The objective of this part is to write a function that successively translates chunks of an integer in order from hundreds to tens, teens, and ones.

  1. Declare a function named numberToHundreds() that takes as parameter an integer.

    function numberToHundreds(number) {  //};
  2. Declare three arrays of strings corresponding to the textual form of ones, teens, and tens used to write digits and numbers from 1 to 99.

    function numberToHundreds(number) {  const ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];