I have a collection of helper-functions, like this:
var myHelpers = {
addFoo: ( name ) => {
return name + 'foo';
},
addFooBar: ( name ) => {
return this.addFoo( name ) + 'bar'; // This is what throws the error.
}
}
window.myHelpers = myHelpers;
export default myHelpers;
And I then use it like this:
import myHelpers from "./myHelpers";
let test = 'abc';
test = myHelpers.addFooBar( test );
But this throws the error: Uncaught TypeError: Cannot read properties of undefined
... How do I make these functions call eachother, without getting this error?