Call Function in Same Level Property in Javascript -


i have object this. want call encodetoken inside callback in refreshtoken property. can body me how javascript work this? thanks.

var obj = {     encodetoken: function (obj){         var opt = {expiresinminutes: 1}         return jwt.sign(obj, config.jwt_key, opt);     },      decodetoken: function (token, callback){         jwt.verify(token, config.jwt_key, function (err, decoded){             callback(err, decoded);         });     },      refreshtoken: function (token, callback) {          this.decodetoken(token, function (err, decoded){             callback(err, howtocall.encodetoken());         });     },  }; 

refreshtoken: function (token, callback) {     var self = this;     this.decodetoken(token, function (err, decoded){         callback(err, self.encodetoken());     }); } 

you can read great explanation here - see simple call , as object method chapters - or here.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -