Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

193
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda