I am new to Javascript and currently trying my hand at creating a variable called pets
with an array ['cat', 'dog', 'rat']
. I want to use a for loop to pluralize each word in the array.
This is my code:
var pets = ['cat', 'dog', 'rat'];
for (pets[i] = pets[i] + 's';) {
};
console.log(pets);
The error encountered is:
for (pets[i] = pets[i] + 's';) {
^
Could not run: Unexpected token )