1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
 5     <title></title>
 6     <script type="text/javascript">
 7         var person1 = {
 8             toLocaleString:function () {
 9                 return "Nikolaos";
10             },
11             toString:function () {
12                 return "Nicholas";
13             }
14         };
15         var person2 = {
16             toLocaleString:function () {
17                 return "Grigorios";
18             },
19             toString:function () {
20                 return "Greg";
21             }
22         };
23         var people = [person1, person2];
24         console.log(people);
25         console.log(people.toString());
26         console.log(people.toLocaleString());
27     </script>
28 </head>
29 <body>
30 </body>
31 </html>

IE下显示

Nicholas,Greg

Nicholas,Greg  

Nikolaos, Grigorios

firefox、chrome下显示

Nicholas(Object),Greg(Object)

Nicholas,Greg 

Nikolaos, Grigorios

 

 

 

相关文章:

  • 2021-12-23
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2022-01-05
相关资源
相似解决方案