I am trying to make a generator of simple sentences by combining data from two arrays. One array has the nouns/subjects and the other the verbs/actions.

Obviously, some nouns are singular and some plural. To make this work, I make the nouns objects (and a class), eg: `{ txt: "Jason", snglr: true }, { txt: "The kids" }`.

Then, I create a function that forms the verb according to whether the noun is singular or plural (`snglr: true` or `false`/`undefined`) and apply it as a method of the noun class.

I call the method from within the string of the verb/action, as in: `{ txt: `${curr_noun.verb("go", "goes")} to music class.`}`

**My problem is that all the verbs get their values from the first noun used.** When I change the noun, the verbs still refer to the plural or singular form called by the first noun.

Is there a way to refresh the actions objects, so that each time their values refer to the current noun?

(Or if I'm totally missing an easier way, can you please let me know?)

Thanks. Here is the whole code:

```

        class noun {
            constructor(text, singular) {
                this.txt = text; // The subject of the sentence
                this.snglr = singular; // Whether the subject is singular (true) or plural (undefined/false)
                this.verb = function (plur, sing) { //this function is called from within the string containing the verb (see "actions" array, below)
                    if (sing == undefined) { // for regular verbs, we call it with one argument, eg. .verb("walk"), it creates "walks" by adding "s."
                        sing = plur + "s";
                    }
                    if (this.snglr) { // for irregular verbs, we call it with two arguments, eg. .verb("go", "goes")
                        return sing;
                    } else {
                        return plur;
                    }

                }
            }
        }

        var curr_noun = {};

        var nouns = [new noun("Jason", true), new noun("The kids")];

        curr_noun = nouns[0]; // We pick "Jason" as the sentence's subject.

        var actions = [
            { txt: `${curr_noun.verb("go", "goes")} to music class.`},
            { txt: `${curr_noun.verb("visit")} London.`}
        ];

        curr_action = actions[1];
        console.log(`${curr_noun.txt} ${curr_action.txt}`);

        // All good, so far.
        // My problem is that the above values of actions[0].txt and actions[1].txt are given based on Jason.
        // When I later change the curr_noun to "The kids," I still get singular verb forms.

        curr_noun = nouns[1];
        curr_action = actions[0];
        curr_noun.verb();
        console.log(`${curr_noun.txt} ${curr_action.txt}`);

```