Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!