var str = "hello world";
document.write(str[1]); //输出结果e ie7前的浏览器不兼容
document.write(str.charAt(0)); //输出结果h 兼容浏览器
document.write(str.charCodeAt(4)); //输出结果111 返回o字符串的编码