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
Envato Tuts+ Code @TutsPlusCode

Tweet a JS quick tip, and hash #jsEdu at the end to enter to win a copy of JavaScript Patterns. http://bit.ly/9xYHyW

2010-10-12 23:44:38
Cédric Michaux @he8us

Use auto-executing function -- (function(){ ... })() -- to simulate private functions and variables in Javascript #jsEdu

2010-10-12 23:44:37
Kosso 🌐 @kosso

JavaScript versions of many useful PHP functions http://phpjs.org/ #jsEdu cc: @nettuts

2010-10-12 23:47:36
David Díaz @Seich

You can use the following notation to create a javascript object: var car = { colour:'red', wheels:4} #jsEdu

2010-10-12 23:50:40
Ayman Safadi @aymansafadi

Never bind JavaScript behavior to a link pointing to nothing (e.j. "#"). Always give links a real destination (graceful degradation) #jsEdu

2010-10-12 23:50:41
Alexander Vey @dailyway

Use 'e.preventDefault();' and/or 'e.stopPropagation();' instead of 'return false;' #jsEdu

2010-10-12 23:51:40
Matt Tortolani @doodlemoonch

Use {} instead of new Object() and [] instead of new Array() #jsEdu

2010-10-12 23:52:23
@CavCurt

@nettuts Avoid using the eval() function! #jsEdu --The 14th is my birthday also. Take that into account.

2010-10-12 23:52:39
Christopher Webb @conspirator

If you're interested in object-oriented JavaScript, check out my post: http://notes.conspirator.co/post/1269595708/oojs #jsEdu

2010-10-12 23:52:44
arjo @arjo

@nettuts Learn to use http://www.jslint.com/ "it will hurt your feelings" ;-) #jsEdu

2010-10-12 23:52:47
Sebastian Senf @mustardamus

//JS shortcut for parseInt(): typeof ​parseInt('1') == typeof +'1'​​​ //true (number) #jsEdu

2010-10-12 23:53:41
Estevão Mascarenhas @estevaoam

It's obvious but always indent your javascript code correctly. #jsEdu

2010-10-12 23:53:45
John Nelson @johncoder

Wrap your javascript code (i.e. jQuery plugins) in a self executing function to limit library collisions #jsEdu http://bit.ly/cnfzlm

2010-10-12 23:54:43
Anthony @Johnner

Copy the link to the context of the outer function: "var that = this" and use "that" in closures to access parent function context #jsEdu

2010-10-12 23:55:22
Howard @citizen_of_now

In your addressbar, javascript:location=document.referrer; Allows you to go back even when there's no back button. #jsEdu

2010-10-12 23:56:35
Ricardo Rodrigues @ricmrodrigues

Use the defer attribute for ie only external scripts #jsEdu

2010-10-12 23:56:42
Clément Legrand @lemacbacon

Always put your Javascript at the bottom of the page ! #jsEdu

2010-10-12 23:57:14
Ian L. @MrSaints

Avoid using global variables! Use namespaces and follow the trend ;) #jsEdu @nettuts

2010-10-12 23:58:50
Ethan Gardner @EthanGardner

use object literals and logical operators to suppress errors and check for namespaces (i.e. window.EDG = window.EDG || {};) #jsEdu

2010-10-12 23:59:17
Colm Britton @ColmBritton

Comment, comment, comment. Your code is only a view source away from anyone so educate and help them understand your mind. #jsEdu

2010-10-13 00:01:07
Jeremy Clements @jeremy_clements

Keep DOM lookup/access to a minimum, because it can be very expensive; cache elements that will be frequently used. #jsEdu

2010-10-13 00:03:22
残りを読む(344)

コメント

azu @azu_re 2010年10月15日
ちょこっと追加。まあこの辺で止めておくか。
0