JavaScript | Tips

Object-Oriented JavaScript Tip: Overriding toString() for readable object imprints

JavaScript has a core Object class that contains a toString() method that is called whenever a request is made to convert an object to a string (like related ECMAScript-based ActionScript). This is often done during debugging to check that a variable actually contains a reference to a certain object. Most likely alert(myObj) or console.log(myObj) would [...]

Read the rest of this entry...