Created
January 27, 2010 13:29
-
-
Save mooz/287828 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let str = ""; | |
let buffer = []; | |
for each (let c in str) | |
{ | |
buffer.push(c); | |
} | |
window.alert(buffer.join("")); | |
// 以下のような文字列が返る。 | |
// function (b) { | |
// return this.indexOf(b) == 0; | |
// }function (b) { | |
// var c = this.length - b.length; | |
// return c >= 0 && this.lastIndexOf(b, c) == c; | |
// }function () { | |
// for (var b = this, c = 0; c < arguments.length; c++) { | |
// b = b.replace(/\%s/, String(arguments[c])); | |
// } | |
// return b; | |
// } | |
buffer = []; | |
for (let [, c] in Iterator(str)) | |
{ | |
buffer.push(c); | |
} | |
window.alert(buffer.join("")); | |
// => 空文字が返る |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.google = function () "sucks"; | |
for each (let c in "") | |
{ | |
window.alert("for each => " + c); | |
} | |
// for each => function () "sucks" | |
for (let [, c] in Iterator("")) | |
{ | |
window.alert("iter => ", c); | |
} | |
// window.alert は呼ばれない |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment