How to mount a method to the prototype of a Date () instance in vue?

< H1 > created a Date () instance an in vue. I want to mount a method b on the instance so that var month = a.getMonth () + 1; I can call the b method < / H1 > through month.b ()

Code is:

   var a = new Date();
   a.prototype = {
       b: function () {
           console.log("111111");
           }
           }
     var month = a.getMonth();
     month.b();

but the grammar does not pass, may I ask why? In the Vue project

Nov.30,2021

a.getMonth () returns a number. How to call the method? your syntax is not correct. It has nothing to do with vue.


instance does not have a prototype. The constructor
should be posted on Date.prototype


.

a.prototype = xxxx

Change

to

Date.prototype = xxxx


should be posted on Date.prototype
and it is not recommended to modify the built-in prototype

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3720f-2c079.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3720f-2c079.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?