Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
How does JavaScript define a new string type?

First, I define a default string.

var string = new String();

But I wanted to have a more powerful string, so I added some methods to the prototype of string.

String.prototype.md5sck

That's good, but I hope he's a new type.

var string2 = new String2();
string2.prototype.substring();//Method with inherit default string
string2.prototype.md5sck();//Have additional methods
string.prototype.md5sck();//null The system default string method will not be affected.

And I have to make sure my method can't be modified by others

var string2 = new string2();
string2.prototype.md5sck = ???; // After new(), I hope this behavior will be prohibited
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

var string = new String();
String.prototype.md5sck = () => { console.log("md5 check") };

class String2 extends String {
   // define here
}

var string2 = new String2();

string2.md5sck()

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda