- Open your command-line application and navigate to your workspace.
- Create a new folder named 06-04-define-function-properties-as-method.
- Copy or create an index.html that loads and runs a main function from main.js.
- Create a main.js with a function named main that defines two methods with the property and method syntax, overrides them, and calls them before and after override:
// main.js export function main() { const obj = { method0: function() { console.log('Hello, from method one.') }, method1() { console.log('Hello, from method one.') } }; obj.method0(); obj.method1(); obj.method0 = () => console.log('Override of method 0.'); obj.method1 = () => console.log('Override of method 1.'); obj.method0(); obj.method1(); }