Can I use a string instead of function?


Can I just assign a string to the property of “eat” as it is not so complicated, like the following:
eat: “nom nom nom”
is there any difference?

Not if eat is supposed to be a function. A function does something and returns a value. A string is just a series of characters but doesn’t do anything (it just holds a value). So they aren’t interchangeable.