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

162
Visualizações
Why does console.log(new Map<String, Number>([])) log true, true in JavaScript?

What exactly is causing this TypeScript-like expression to log true, true in JavaScript?

console.log(new Map<String, Number>([]))

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you format it differently, you can see that this might look like TS, but it's just JavaScript. Coincidentally, the angle brackets and the comma match perfectly with the syntax for the two arguments of console.log, where each is a comparison, less than and greater than. What is being compared is:

new Map < String // true
Number > [] // true

Written out in a way that makes this more obvious:

console.log(new Map < String, Number > ([]))

If you meant to write this in a TS file where it might get interpreted (as you may have intended) as a type generic, then you are probably looking for different types: string and number, rather than the String and Number constructors that you used in the example.

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