javascript中字符串的两种定义形式
1、var s = "this is a string";
var t = "this is also a string";
s.test = 20;
2、var s = new String("this is a string");
var t = new String("this is also a string");
s.test = 20;
这两种方式有何区别?
第一种方式定义的test为s、t以及将来的所用此种形式定义的字符串定义了test.
第二种方式定义的test仅为s定义.