标签:ascii码 返回值 string int 应该 alert script func rip
var map = Array.prototype.map
var a = map.call("Hello World",function(x){
return x.charCodeAt(0);
})
// a的值为[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]
// 字符转ascii码:用charCodeAt();
// ascii码转字符:用fromCharCode();
function returnInt(e){
return parseInt(e,10);
}
["1","2","3"].map(returnInt);
// 此时会返回[1,2,3]
标签:ascii码 返回值 string int 应该 alert script func rip
原文地址:http://www.cnblogs.com/memphis-f/p/7308842.html