Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a javascript object's toString function affected by localisation?

This might be a very silly question, but can I rely on the toString() function regardless of the language settings of a client?

That is, for me:

x = true;
x.toString();  // "true"

If someone from France ran my application, would the output be "true" or "vrai"?

like image 358
nickf Avatar asked Dec 16 '22 16:12

nickf


1 Answers

For booleans, a conforming ECMAScript interpreter must convert true to "true" and false to "false" (§9.8 and §15.6.4.2).

like image 160
kennytm Avatar answered Jan 11 '23 22:01

kennytm