获取对象下属性的方法
var tmp = 'name';
console.log(p1.name);
console.log(p1['name']);
console.log(p1[tmp]);
字符串对象
- replace("world","Aiors") 把world替换成Aiors
- split 把字符串转换成数组
- indexof检索字符串中某个字符首次出现的位置,如果没有返回-1
- lastindexof 检索字符串中某个字符最后一次出现的位置
- substr(index,length)从index开始,截取length长度的字符串
- substring(start,end) 不包含end的截取与slice相同
- charAt(0)指定字符串位置