From 8e75a403fb4b6fe5ce03fd4c8e4d44df80917e5a Mon Sep 17 00:00:00 2001 From: zainabdnaya Date: Fri, 13 Oct 2023 17:36:16 -0400 Subject: [PATCH] docs(numberOfLetters): Adding the subject of exercice numbersOfLetters for js piscine --- subjects/numberOfLetters/README.md | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 subjects/numberOfLetters/README.md diff --git a/subjects/numberOfLetters/README.md b/subjects/numberOfLetters/README.md new file mode 100644 index 000000000..ad183db51 --- /dev/null +++ b/subjects/numberOfLetters/README.md @@ -0,0 +1,41 @@ +## numberOfLetters + +### Instructions + +Create a function that if we write out the digits of "60" as English words we get "sixzero"; the number of letters in "sixzero" is seven. + +The number of letters in "seven" is five. The number of letters in "five" is four. The number of letters in "four" is four: we have reached a stable equilibrium. + +Note: for integers larger than 9, write out the names of each digit in a single word (instead of the proper name of the number in English). + +For example, write 12 as "onetwo" (instead of twelve), and 999 as "nineninenine" (instead of nine hundred and ninety-nine). + +For any integer between 0 and 999, return an array showing the path from that integer to a stable equilibrium. + +### Expected function + +```js +function numberOfLetters(int) { +} +``` + +### Usage + +Here is a possible program to test your function: + +```js +console.log(numbersOfLetters(60)) +console.log(numbersOfLetters(1)) +``` + +and the output should be: + +```console +$ node index.js +["sixzero", "seven", "five", "four"] +["one", "three", "five", "four"] +$ +``` + + +