Trying to learn to use objects created in JS
✓ Published0🌍 Public
MMistyBlunch
Last edited Apr 2, 2018
Created on Apr 2, 2018
This example demonstrates JavaScript object-oriented programming using a custom `ToDo` constructor and prototype methods. The code defines a `ToDo` function that assigns an `action` property, then extends it with a `sayAction` method via the prototype. Two instances, `grace` and `mistyblunch`, are created and their `sayAction` methods are called, logging their respective action strings to the console. The script also directly accesses and logs the `action` properties of each object. It uses no external libraries or data sources, relying solely on native JavaScript object creation, constructor functions, and prototype-based inheritance to illustrate basic object behavior and property access.
AI-generated description