- Tab indentation
- Single-quotes
- Semicolon
- Strict mode
- No trailing whitespace
- Multiple variable statements
- Space after keywords and between arguments and operators
- Return early
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
/* | |
** intersect.js | |
** intersect multiple arrays | |
** Usage: | |
var arr1 = ['hey', 'you', 'guys', 'test', 'there']; | |
var arr2 = ['there', 'you']; | |
var arr3 = ['some', 'there', 'you', 'thrice', 'hey', 'huzzah']; | |
intersect(arr1, arr2, arr3); | |
*/ | |
function intersect() { |
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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent