I have a JavaScript object that's defined like this:
const test = {
myFirstFunction: () => {
console.log('MyFirstFunction called');
this.mySecondFunction('data');
},
mySecondFunction: (param) => {
console.log('MySecondFunction called ' + param);
}
};
test.myFirstFunction();
When I run this code, I receive an error that says:
"Uncaught TypeError: this.mySecondFunction is not a function".
I don't understand why. What am I doing wrong?