When you try to display an object using methods like alert() or console.log(), JavaScript implicitly calls the object’s toString() method.
When you try to display an object using methods like alert() or console.log(), JavaScript implicitly calls the object’s toString() method.