Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75b2d11

Browse files
committed
Merge pull request chuanxshi#19 from hitsthings/patch-1
I thought the conditionals.html file was a bit misleading.
2 parents ba787aa + d303c6c commit 75b2d11

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

general-patterns/conditionals.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
</head>
77
<body>
88
<script>
9+
// NOTE: Paul Irish states that the first statement is only an antipattern when optimizing for
10+
// low-bandwidth source (such as for a bookmarklet.
11+
// Using the first statement will generally outperform the regex in a loop, and is faster than the
12+
// object literal for lower numbers of conditions (they generally even out around 10 conditions).
13+
// See http://jsperf.com/if-this-or-that
14+
915
// antipattern
1016
if (type === 'foo' || type === 'bar' ) {}
1117

0 commit comments

Comments
 (0)