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

詳細は"10 Free Copies of “JavaScript Patterns” from O’Reilly Books | Nettuts+" 要は #jsEdu つけてJavaScriptのTips投稿してね。の検索メモ。 追記:一部取り出して日本語にしてみました。 続きを読む
Envato Tuts+ Code @TutsPlusCode

Tweet a JS quick tip, and hash #jsEdu at the end to enter to win a copy of JavaScript Patterns.

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 #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

@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: #jsEdu

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

@nettuts Learn to use "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

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
1 ・・ 15 次へ