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 ・・ 3 4 ・・ 15 次へ
Roger Wakeman @rgrwkmn

Don't try to be smart when debugging. Use copious logs/alerts to track down bugs. #jsEdu #javascript

2010-10-13 00:53:28
Anders Ringqvist @anddoutoi

default and guard operator: var foo = o || {};//init with empty obj if o is falsy var bar = o && o.bar;//if o is truthy, return o.bar #jsEdu

2010-10-13 00:56:51
E @Endijs

Use [] (e.g. var a = ['a','b']; ) instead of: new Array(); (e.g. var a = new Array(); a.push('a'); a.push('b');) #jsEdu

2010-10-13 01:04:06
Felix Chi @felixchi

use counter += 10 instead of counter = counter + 10 #jsEdu

2010-10-13 01:06:49
Markus Zeller @markuszeller

10 Free Copies of “JavaScript Patterns” from O’Reilly Books - http://tinyurl.com/32kuv3g) #jsEdu

2010-10-13 01:08:32
theRegge @theRegge

Use a single 'var' statement to declare your scope variables #jsEdu

2010-10-13 01:09:03
@anttti@mastodon.social @anttti

If one needs a DOM element's ID in jQuery, it makes no sense to do $(this).attr("id") -- you can just write this.id. More efficient! #jsEdu

2010-10-13 01:11:03
David R @sachindavids

Avoid using global variables in JavaScript, Instead go for the nested functions which are very reliable than global variables. #jsEdu

2010-10-13 01:14:28
Sam Shull @samshull

Global variables and functions are rarely required. Using globals may cause code to break. #jsEdu

2010-10-13 01:18:12
John McCaffrey @j_mccaffrey

the browser UI thread is responsible for rendering and evaluating js, move your js to the bottom to improve rendering speed #jsEdu

2010-10-13 01:21:49
John McCaffrey @j_mccaffrey

already improved page load performance with #yslow and #pagespeed? now use http://ajax.dynatrace.com/ to improve javascript perf #jsEdu

2010-10-13 01:24:13
Tyler Brinks @tylerbrinks

Accessing modified closures is what makes JavaScript so powerful. Make use of the 'this' keyword for scoping callback references. #jsEdu

2010-10-13 01:26:09
Premraj M. @premrajm

In javascript, void is an operator that takes an operand and returns undefined. Avoid void #jsEdu

2010-10-13 01:28:01
Bonnie DiPasquale @vaskointeractv

Always use 'var' when declaring variables in your objects to avoid polluting the global namespace #jsEdu

2010-10-13 01:34:33
Shahor @Shahor

When creating classes in javascript, add your methods using [Class].prototype.[method] to load class definition only once. #jsEdu

2010-10-13 01:35:27
Tiny Giant Studios @tinygiantstudio

Javascript Best Practice: Save your hairline and ALWAYS comment out EVERYTHING, EVERYWHERE. No excuses. #jsEdu

2010-10-13 01:36:54
Premraj M. @premrajm

Javascript has two sets of equality operators: === and !==, & their evil twins == and !=. The good ones work the way you expect. #jsEdu

2010-10-13 01:38:39
Janel @JanelSoLit

Discover different ways to define a function in JavaScript #jsEdu

2010-10-13 01:40:00
John McCaffrey @j_mccaffrey

using #jquery on IE 6 or 7? avoid selectors by classname only, as it will have to iterate the full dom. prefer id or tag #jsEdu

2010-10-13 01:40:08
saumya @saumya

if u r on jquery for javascript,keep an eye on "return false" at the end of any function definition. missing that may cost you a lot. #jsEdu

2010-10-13 01:40:38
Eugene Kashida @ekashida

undefined, unlike null or window, is not a reserved word and can be redefined #jsEdu

2010-10-13 01:43:33
Roger Wakeman @rgrwkmn

== and != do not match types. Don't dismiss them bc you haven't used them correctly in the past. #jsEdu #javascript

2010-10-13 01:43:40
前へ 1 ・・ 3 4 ・・ 15 次へ