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

268
Views
JavaScript question: Calling toString() on primitive types

A quick question coming from someone learning JavaScript. So far I am aware that primitive types hold only their value, so why is it I can store a number (a primitive type) and then call the toString method on it as if it were an object? e.g.

let num = 4;
let strNum = num.toString(); /* how is this possible? isn't num just a single piece of data in memory, how can it access this toString method? */
about 4 years ago · Juan Pablo Isaza
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!