2022-01-12 14:58:42 -08:00

22 lines
480 B
JavaScript

module.exports = Phrase;
// Adds `reverse` to all strings.
String.prototype.reverse = function() {
return Array.from(this).reverse().join("");
}
function Phrase(content) {
this.content = content;
.
.
.
// Returns true if the phrase is a palindrome, false otherwise.
this.palindrome = function palindrome() {
if (this.processedContent()) {
return this.processedContent() === this.processedContent().reverse();
} else {
return false;
}
}
}