Skip to content

Instantly share code, notes, and snippets.

@akash-rajput
Created June 19, 2020 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akash-rajput/f2290806123418eb84e57b7ef8b89eb9 to your computer and use it in GitHub Desktop.
Save akash-rajput/f2290806123418eb84e57b7ef8b89eb9 to your computer and use it in GitHub Desktop.
const sizeof = require("object-sizeof");
class ABC {
constructor() {
this.data = "asdd";
this.iMethod = this.iMethod.bind();
}
iMethod() {
console.log("instance method called");
}
static sMethod() {
console.log("static method called");
}
}
console.log("typeof ABC", typeof ABC);
console.log("prototype ABC", ABC.prototype);
const obj = new ABC();
console.log("class object", obj);
console.log("typeof Obj", typeof obj);
console.log("sizeof object", sizeof(obj));
console.log("typeof obj.iMethod", typeof obj.iMethod);
console.log("typeof obj.sMethod", typeof obj.sMethod);
console.log("sizeof obj.sMethod", sizeof(obj.sMethod));
console.log("sizeof ABC.sMethod", sizeof(ABC.sMethod));
console.log("prototype of ABC.sMethod", ABC.sMethod.prototype);
debugger;
console.log("prototype of ABC.sMethod", ABC.sMethod.prototype);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment