@kyi193/kevins-thought-machine
Version:
Randomly return an answer for a yes or no question
44 lines (35 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var IfFanOfThisMovieGoodResponse = /*#__PURE__*/function () {
function IfFanOfThisMovieGoodResponse() {
_classCallCheck(this, IfFanOfThisMovieGoodResponse);
this.movies = ['the Lord of the Rings', 'The Matrix', 'Parasite', 'Memento', 'No Country For Old Men', 'Back to the Future', 'Jurassic Park', 'The Dark Knight', 'Inglourious Basterds', 'Her', 'The Shawshank Redemption', 'Blade Runner'];
this.randomMovie;
}
_createClass(IfFanOfThisMovieGoodResponse, [{
key: "getAnswer",
value: function getAnswer() {
var randomMovieIdx = Math.floor(Math.random() * this.movies.length);
var randomMovie = this.movies[randomMovieIdx];
this.randomMovie = randomMovie;
return "If you're a fan of ".concat(randomMovie, ", you're in luck!");
}
}, {
key: "getResults",
value: function getResults() {
return {
answer: this.getAnswer(),
index: 9,
randomMovie: this.randomMovie
};
}
}]);
return IfFanOfThisMovieGoodResponse;
}();
exports["default"] = IfFanOfThisMovieGoodResponse;