<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
Date.prototype.name="not good";
var d=new Date();
document.getElementById("demo").innerHTML =d.name;
</script>
</body>
</html>
Result-
not good
In the above example the name field is being added to the Data object using the prototype functionality.
What could be the drawbacks of doing this? Are the changes made here will reflect permanently?
According to w3scholls I got this note- Only modify your own prototypes. Never modify the prototypes of standard JavaScript objects.
But sometimes isn't it convenient?