Sobes.tech
Junior — Senior

Rewrite the String prototype method to output a phrase with a name

livecode

Task condition

It is necessary to correct the given JavaScript fragment so that the method givePizza, added to String.prototype, returns a string of the form <text>, just give pizza!.

String.prototype.givePizza = function() {
    return `${this}, just give pizza!`;
};
const person = 'Mau';
person.givePizza(); // Mau, just give pizza!

After the correction, calling person.givePizza() should output the string Mau, just give pizza!.

Rewrite the String prototype method to output a… - sobes.tech