Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Foo(x) {
- this.x = x;
- this.y = 432;
- }
- Foo.prototype.point = function() {
- return 'Foo(' + this.x + ', ' + this.y + ')';
- }
- var myfoo = new Foo(99);
- console.log(myfoo.point()); // prints "Foo(99, 432)"
- class Foo {
- constructor(x) {
- this.x = x;
- this.y = 432;
- }
- point() {
- return 'Foo(' + this.x + ', ' + this.y + ')';
- }
- }
- let myfoo = new Foo(99);
- console.log(myfoo.point()); // prints "Foo(99, 432)"
Add Comment
Please, Sign In to add comment