JavaScriptのベストプラクティス大会 jsEdu

詳細は"10 Free Copies of “JavaScript Patterns” from O’Reilly Books | Nettuts+" http://net.tutsplus.com/freebies/books/10-free-copies-of-javascript-patterns-from-oreilly-books/ 要は #jsEdu つけてJavaScriptのTips投稿してね。の検索メモ。 追記:一部取り出して日本語にしてみました。 続きを読む
13
前へ 1 2 ・・ 15 次へ
Cory Evan Wright @BeSublime

Always put the opening brace of an if statement, function, etc. on the same line as the beginning of the statement or declaration. #jsEdu

2010-10-13 00:03:31
Vipul Limbachiya @vipullimbachiya

Declare variable outside the for statement which is used for each loop #jsEdu

2010-10-13 00:04:03
Tom Brander @dartdog

Javascript the language for web mobile apps "JavaScript Patterns" from O'Reilly Books http://is.gd/fYJ4l #jsEdu

2010-10-13 00:04:05
Nick Plekhanov @nickplekhanov

Avoid sync Ajax calls as it will wait for the request to return before continuing,while async mode runs the request in the background #jsEdu

2010-10-13 00:05:14
Vipul Limbachiya @vipullimbachiya

don't change variable's type after declaration ie. var test = "hello"; test = 10; #jsEdu

2010-10-13 00:06:37
Vipul Limbachiya @vipullimbachiya

Try to do feature detection and not browser detection #jsEdu

2010-10-13 00:07:38
Scott Allen @svallen

When using forms you can do $("input[name='id']").val(); instead of always needing to put and id on the input tags. #jsEdu

2010-10-13 00:07:52
Chris Maggs @maggsweb

When outputting HTML using JavaScript, always escape the forward slash ('/') by placing a backward slash ('\') in front of it. #jsEdu

2010-10-13 00:08:57
Charasan @charasan

Whenever possible, place scripts at the bottom of your page, not the top. Avoid blocking the DOM loading. #jsEdu

2010-10-13 00:09:33
Anthony @Johnner

Always wrap your if-else statements in braces {}. Even if its only one operator in condition: if(..){...} else{...} #jsEdu

2010-10-13 00:10:00
CyberSpektre @CyberSpektre

To speed up the pages render, put the scripts (when possible) at the bottom of body (JS scripts block parallel downloads). #jsEdu @nettuts

2010-10-13 00:10:13
tekbirdr @tekbirdr

Always use an object literal -- {} -- instead of the new Object() constructor. #jsEdu

2010-10-13 00:10:59
stagas @stagas

Use 'return this' when you want to chain methods of an object similar to jQuery. #jsEdu

2010-10-13 00:11:09
Lupo Montero @lupomontero

Wrap code inside "for in" loops in hasOwnProperty() conditional 2 make sure u exclude properties from the prototype chain #jsEdu

2010-10-13 00:11:36
Carlos Cano @canogt

Preferred way to declare objects and arrays: var person = {}, keys = []; #jsEdu

2010-10-13 00:12:13
kartik sehgal @kartiksehgal

@nettuts always minimize your JavaScript (using compression tools like YUI compressor) on deployment & improve the page performance #jsEdu

2010-10-13 00:12:32
Roger Wakeman @rgrwkmn

parseInt on strings starting with 0 will not return what you expect. Try "01" through "0100" in a loop to see. #jsEdu #javascript

2010-10-13 00:13:38
tdarb @bradtaunt

Use [] Instead of New Array() #jsEdu

2010-10-13 00:14:51
Martin Koistinen @mkoistinen

Create local copies of objects or functions used frequently in the body of a function to reduce the time required for name-lookups. #jsEdu

2010-10-13 00:15:06
Zach Mau @zachmau

JavaScript is case sensitive | Use defer attrib. for IE scripts, Firefox 3.5 also supports | Use try-catch to prevent error display #jsEdu

2010-10-13 00:15:27
Mike Kretz @kretzm

Make sure to always comment your code. I need to understand it too! #jsEdu

2010-10-13 00:17:43
Dean Peterson @dpeterson_1

declare all variables with "var" @ the start of every JavaScript function. #jsEdu

2010-10-13 00:18:48
Dean Peterson @dpeterson_1

Live and Breath "JavaScript: The Good Parts" by Douglas Crockford. #jsEdu

2010-10-13 00:19:17
@andredublin

With scoping and hositing, always declare your varialbes with a var statment, and that it be at the top of your function. #jsEdu

2010-10-13 00:19:31
前へ 1 2 ・・ 15 次へ