← Back to challenges

Functioninator 8000

JavaScriptHardformattingstrings

Instructions

Create a function that takes a single word string and does the following:

  1. Concatenates inator to the end if the word ends with a consonant otherwise, concatenate -inator instead.

  2. Adds the word length of the original word to the end, supplied with '000'.

The examples should make this clear.

Examples

inatorInator("Shrink") ➞ "Shrinkinator 6000"

inatorInator("Doom") ➞ "Doominator 4000"

inatorInator("EvilClone") ➞ "EvilClone-inator 9000"

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Word Nests