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

151
Visualizações
Calling method on primitive string? "string".length why this is possible although string is not an object

Javascript has 7 primitive values as string,number,bigint,boolean,undefined,symbol, null. What I don't understand they are not really objects when we declare them. And their type is not an object. And we can still call methods on strings. How is that possible?

When we create strings(str1 = "aysel" and check typeof is a string then if you check typeof string comes to function. But if I create str2= new String("aysel") Typeof str2 is obj. But we can call str1.length on primitive string too. Although we have never defined as an object on first place.

about 4 years ago · Juan Pablo Isaza
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