Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createMixins() {
- function computerQualityMixin(classToExtend) {
- classToExtend.prototype.getQuality = function () {
- return (this.processorSpeed + this.ram + this.hardDiskSpace) / 3;
- };
- classToExtend.prototype.isFast = function () {
- return this.processorSpeed > (this.ram / 4)
- };
- classToExtend.prototype.isRoomy = function () {
- return this.hardDiskSpace > Math.floor(this.ram * this.processorSpeed)
- };
- }
- function styleMixin(classToExtend) {
- classToExtend.prototype.isFullSet = function () {
- return this.manufacturer === this.keyboard.manufacturer &&
- this.keyboard.manufacturer === this.monitor.manufacturer
- };
- classToExtend.prototype.isClassy = function () {
- const isCorrectColor = this.color === "Silver" || this.color === "Black";
- return this.battery.expectedLife >= 3 && isCorrectColor && this.weight < 3
- }
- }
- return {
- computerQualityMixin,
- styleMixin
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment