About 6,200,000 results
Open links in new tab
  1. javascript - Converting an object to a string - Stack Overflow

    Apr 10, 2011 · 18 In cases where you know the object is just a Boolean, Date, String, number etc... The javascript String () function works just fine. I recently found this useful in dealing with …

  2. 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 …

  3. 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 …

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

    As @RobG pointed out, the output of Date.prototype.toString () is implementation-dependent, so for international or non-browser implementations, just test the output to be sure it works right in …

  5. 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?

  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 toString() method - Stack Overflow

    Jul 8, 2012 · Say hol is a Date() object. Why is hol.toString() useful or helpful? isn't it the same as just writing/outputting hol? also other related methods such as toDateString() toTimeString()

  8. 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.

  9. 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, …

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

    Jun 2, 2019 · I have a function that should take as an argument of the object and return a string The code I wrote. function check(obj) { return obj.toString(); }