I have a question regarding JavaScript.
is this good practice to add our own method in prototype class
like I have added my own custom method in String prototype class like this
String.prototype.mirror = function () {
let str = this.toString() ;
return str.split('').reverse().join('')
}
and now i am using my own method with any string value like
"hello".mirror()
"olleh"
Top comments (0)