Created
August 15, 2016 23:20
-
-
Save ChuckJonas/5171f5e41a44f44a4b23d5c749657ff1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeting { | |
static intro = 'Hello '; | |
constructor(name) { | |
this.name = name; | |
} | |
get hello() { | |
return Greeting.intro + this.name; | |
} | |
} | |
const greeting = new Greeting('Charlie'); | |
console.log(greeting.hello); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Greeting { | |
constructor(name) { | |
this.name = name; | |
} | |
get hello() { | |
return Greeting.intro + this.name; | |
} | |
} | |
Greeting.intro = 'Hello '; | |
const greeting = new Greeting('Charlie'); | |
console.log(greeting.hello); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
var Greeting = function () { | |
function Greeting(name) { | |
_classCallCheck(this, Greeting); | |
this.name = name; | |
} | |
_createClass(Greeting, [{ | |
key: 'hello', | |
get: function get() { | |
return Greeting.intro + this.name; | |
} | |
}]); | |
return Greeting; | |
}(); | |
Greeting.intro = 'Hello '; | |
var greeting = new Greeting('Charlie'); | |
console.log(greeting.hello); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment