ç¥ã£ã¦ã¾ããï¼
var \u5929\u91CE = 'amachang'; alert(天é); // amachang var \u0068\u006f\u0067\u0065 = 'ã»ã'; alert(hoge); // ã»ã
ã¤ãã§ã«ä»åä½ã£ãã¨ã¹ã±ã¼ãé¢æ°ç½®ãã¦ããã¾ãã(Firefox Only)
var unicodeEscape = function (s) { var d = ''; Array.prototype.forEach.call(s, function(c) { var s = c.charCodeAt().toString(16); d += '\\u'; for(var l = s.length; l < 4; l++) d += '0'; d += s; }); return d; };
ä¸ã® unicodeEscape é¢æ°ä½ã£ã¦ã¦çºè¦ãããã ãã©
é
åã® forEach ã£ã¦æååã«ã使ããã¿ããã
ãããªæã
Array.prototype.forEach.call('ãã¼ãã¼ï¼', alert);
ã¨ããã
æ°å¤ã®ããããã£ã¨ length ããããã£ãããã¨ä½¿ããã®ã
Array.prototype.forEach.call({0: 0, 1:1, length:1}, alert); // 0 Array.prototype.forEach.call({0: 0, 1:1, length:2}, alert); // 0,1 Array.prototype.forEach.call({0: 0, 1:1, length:3}, alert); // 0,1 Array.prototype.forEach.call({0: 0, 2:2, length:3}, alert); // 0,2
ãã®å®é¨ãããã¾ã length ããããã£ã®å¤ãè¦ã¦ length ã®æ°ã ãæ°å¤ã®ããããã£ãèµ°æ»ããè¦ç´ ãããã°é¢æ°ãå¼ã³åºãã¨ããæåãããã
ã¾ããä»æ§æ¸å«ã¨ãè¨ããããã ãã©ã
ããï¼
Unicode Escape ã®è©±ããããforEach ã®è©±ãã®ã»ããé·ããªã£ã¡ãã£ããª
ã¾ããããã