Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ProtoError (code) {
- const error={
- "1":{
- "code": 100,
- "text": "foo"
- },
- ///...
- }
- self=this
- return error[code]
- }
- ProtoError.prototype.fullText = function(){
- return this.code+" "+this.text
- }
- a = new ProtoError(100) //
- console.log(a) // { code: 100, text: 'foo'}
- b=a.fullText() //a.fullText is not a function
- {
- "code": 100,
- "text": "foo"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement