ToString: No parameter, returns a string representing the value of the object that called the method. JavaScript calls this method when the object needs to be converted to a string.
The return value of the default ToString () method has a very small amount of information (but is useful in detecting the type of the object);
var s = {x:1,y:1}.tostring (); The code evaluates to the string "[Object Object]"
toLocaleString (): Object has a tolocalestring () method that returns a localized character representing the object;
The default toLocaleString () method in object does not do any localization of its own operations, it only calls the ToString () method and returns the corresponding value. The date and number classes have been customized for the toLocaleString () method, and can be used to localize conversions of numbers, dates, and times. The toLocaleString () method of the array class is much like the ToString method, except that each array element calls the toLocaleString () method to convert to a string instead of calling the respective ToString () method;
Number object:
var e=123e.tostring () "123" e.tolocalestring () "123"
Array object:
var aa=[1,2,3]AA. toLocaleString() "A-I"aa. ToString()"The "
Date object:
VarSd=New Date()Sdwed feb 15 2017 11: 21:31 Gmt+ 0800 (cstsd. () "2017/2/15 a.m. 11:21:31" < Span class= "PLN" >sd. () "Wed Feb 11:21:31 gmt+0800 (CST)"
The difference between ToString and tolocalestring in JavaScript