// DO NOT CHANGE THE FOLLOWING INPUTS.
const noun = prompt(“Enter a noun”);
const count = prompt(“Enter a number”);
console.log(noun);
console.log(count);
// Returns the number and pluralized form, like “5 cats” or “1 dog”, given
// a noun and count. Assume there are no irregular plural nouns.
let result = undefined;
The comments are the instructions. I don’t know what the correct code for:
let result =
Then I don’t know what goes in after that. Would it be an if else? So that it returns a number and pluralized form of a noun. As I mentioned I am a true beginner at this.
You could use + to put strings together in JavaScript. "dog" + "s" would be "dogs"
So if you have "dog" in the variable noun
and 5 in the variable count
then count + " " + noun + "s"
would be "5 dogs"
For plurals, you could check the last letter of noun using noun[noun.length - 1]
And you could use the .substring if you only want part of a string, like “up to the next-to-last letter”.