About 3,310,000 results
Open links in new tab
  1. Is it possible to override JavaScript's toString() function to provide ...

    153 When I console.log() an object in my JavaScript program, I just see the output [object Object], which is not very helpful in figuring out what object (or even what type of object) it is. In C# I'm …

  2. Casting to string in JavaScript - Stack Overflow

    Jun 18, 2012 · I found three ways to cast a variable to String in JavaScript. I searched for those three options in the jQuery source code, and they are all in use. I would like to know if there …

  3. What's the best way to convert a number to a string in JavaScript ...

    None of the answers I see at the moment correctly convert -0 to "-0". Note that -0..toString() might appear to work, but it's working by converting 0 to "0", then applying the minus sign to it, …

  4. javascript - Converting an object to a string - Stack Overflow

    Apr 10, 2011 · Greate solution! But could u tell me what happens behind the scenes when you simply do this : console.log(o) ? Since if you try to log an object added to a string , it actually …

  5. How do I format a date in JavaScript? - Stack Overflow

    How do I format a Javascript Date object as a string? (Preferable format: 10-Aug-2010)

  6. javascript - Generate a string of random characters - Stack Overflow

    @Scoop The toString method of a number type in javascript takes an optional parameter to convert the number into a given base. If you pass two, for example, you'll see your number …

  7. javascript - How to convert instance of any type to string? - Stack ...

    I'm implementing a function that receives an argument which it needs to convert to its string representation. If a given object implements a toString() method, then the function should use it.

  8. Javascript toString() method - Stack Overflow

    Jul 8, 2012 · A quick look on W3Schools shows that toString() is called whenever a Date() object needs to be displayed as a string, so you don't need to call it yourself. Also, if you want to …

  9. What's the difference between String(value) vs value.toString()

    Oct 15, 2010 · Javascript has lot's of "tricks" around types and type conversions so I'm wondering if these 2 methods are the same or if there is some corner case that makes them different?

  10. How to convert object into string in javascript? - Stack Overflow

    Jun 2, 2019 · But in a javascript Object you can't have a kebab-case key, unless it's in quotes. So if someone is looking to display an Object in a js syntax highlighter, just remove the dash from …