search

Home  >  Q&A  >  body text

javascript - What is the difference between js's toString method and toLocaleString()

  1. toString() in the js document is used to convert it into a string

  2. toLocaleString() is used to convert to a local string

  3. My code tests are all used to convert them into strings. What is the connection and difference between the two?

I can’t see any difference through the following two pieces of code

phpcn_u1582phpcn_u15822782 days ago911

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-30 09:56:05

    First take a look at MDN and then you can refer to both
    https://developer.mozilla.org...

    https://developer.mozilla.org...

    The description of toLocaleString looks like this

    • Object's toLocaleString returns the result of calling toString(). *

    reply
    0
  • 習慣沉默

    習慣沉默2017-06-30 09:56:05

    reply
    0
  • Cancelreply