I am working on a simple dog object with a name, bark method, and loudBark method.
- 'name' variable has to be global
- 'dog' object should be in global scope
- global variable 'loud' has to be used to create the 'loudBark' method
- im trying to practice shorthand too
This is where I am currently at:
const name = 'Cody';
const loud = 'loud';
const dog = {
bark() { return 'ruff ruff!' },
name,
['${loud}Bark']: function () {
return this.bark.toUpperCase();
},
};
If I call 'dog.loudBark' it says that is not a function, and I'm really confused, especially since I'm just now learning this new syntax and am used to the older one; I forgot what version specifically.