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
| // extensible - boolean | |
| Object.isExtensible(object) // find out if an object is extensible | |
| Object.preventExtensions(object) // You cannot add any more properties. | |
| Object.seal(object) // Cannot delete properties anymore. | |
| Object.freeze(object) // seals + makes every property read-only |
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
| if( !Number.prototype.trunc ) { | |
| Number.prototype.trunc = function trunc(number){ | |
| return Math[ number >=0 ? 'floor' : 'ceil' ](number); | |
| }; | |
| } |
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
| var long_line_1 = "This is a \ | |
| long line"; // ok | |
| var long_line_2 = "This is a \ | |
| long line"; // syntax error | |
| // because there is a space after \ in the second statement |
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
| //Convert a Number to a String | |
| str = num.toString() | |
| str = String(num) | |
| //Convert a String to a Number | |
| num = Number(str); | |
| num = +str; | |
| num = parseInt(str, 10); | |
| parseInt("12em") === 12 // stops at first non digit |
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
| // Templates: | |
| param = { media: 'http://media.valvion.com/' }; | |
| url = "{media}logo.gif".supplant(param); | |
| // Unfortunately, supplant method is not there in ES5 spec, | |
| // so use the below prototype: | |
| if (!String.prototype.supplant) { | |
| String.prototype.supplant = function (o) { |
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
| // subscript notation [] | |
| list = [1, 2, 3]; | |
| list[list.length] = 4; | |
| // don't use dot notation with arrays |
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
| myArray = ['a', 'b', 'c', 'd']; | |
| delete myArray[1]; | |
| // ['a', undefined, 'c', 'd']; | |
| myArray.splice(1, 1) | |
| // ['a', 'c', 'd']; |
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
| User-agent: * | |
| Disallow: /wp-content/ | |
| Disallow: /wp-icludes/ | |
| Disallow: /trackback/ | |
| Disallow: /wp-admin/ | |
| Disallow: /archives/ | |
| Disallow: /category/ | |
| Disallow: /tag/* | |
| Disallow: /tag/ |
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
| User-agent: * | |
| Disallow: /wp-admin | |
| Disallow: /wp-includes |
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset='utf-8'> | |
| <title>JavaScript Chess</title> | |
| <link rel="stylesheet" type="text/css" href="css/style.css"> | |
| </head> | |
| <body> | |
| <div id='board'> | |
| </div> |