var mySelf = {
name: "name",
improving: function () {}
};
+function improve(mySelf){ mySelf.improving(), improve(mySelf) }(mySelf)
<body>
<pre id="error_display"></pre>
<script>
var error_display = document.querySelector("#error_display");
window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
error_display.innerText += "message: '" + errorMsg + "'\t\n url: '" + url + ":" + lineNumber + "';\n\n";
return true;
}
</script>
</body>
var arr1 = [1,3,2],
arr2 = [3,2,4];
var regex = new RegExp('([' + arr1.join("")+ '])', "g");
var str = "0, 1, 2, 3, 4, 5, 6, 7, 8, 9";
str = str.replace(regex, function(n) {
return arr2[arr1.indexOf(parseInt(n))];
});
console.log(str);