Created
November 6, 2014 04:03
-
-
Save Arguseye/01d30d114ae00ec03449 to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
This file contains hidden or 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
| /** | |
| * The first commented line is your dabblet’s title | |
| */ | |
| background: #f06; | |
| background: linear-gradient(45deg, #f06, yellow); | |
| min-height: 100%; |
This file contains hidden or 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
| <!-- content to be placed inside <body>…</body> --> |
This file contains hidden or 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
| // alert('Hello world!'); | |
| Array.prototype.forEach = function(fn, thisArg){ | |
| //参数需要判断,throw exception是规范里面写的 | |
| if(typeof fn !== "function"){ | |
| throw new Error("TypeError exception"); | |
| } | |
| var array = this, | |
| length = array.length,//减少作用链的请求,在做数组操作时要考虑到length的自增长 | |
| i = 0; | |
| //var a = function() { console.log(this); }; a.call(void 0); void 0 给和不给this的对象都是指向window的,下面这句话是多于 | |
| //thisArg = (typeof thisArg === "undefined" ) ? window : thisArg; | |
| for(;i < length;i++){ | |
| //var a = []; a[3] = 4; a.hasOwnProperty(1) === false; a.hasOwnProperty(3) === true; 就找第三个这个元素 | |
| if(array.hasOwnProperty(i)){ | |
| fn.call(thisArg, array[i], i, array); | |
| } | |
| } | |
| } |
This file contains hidden or 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
| {"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"javascript"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment