From 0ac46a3ae83ddae68d3cc8c5d8c95cb3b55a1c06 Mon Sep 17 00:00:00 2001 From: Maxim Syabro Date: Mon, 6 May 2013 11:38:56 +0800 Subject: [PATCH] Update single-var-pattern.html --- general-patterns/single-var-pattern.html | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/general-patterns/single-var-pattern.html b/general-patterns/single-var-pattern.html index 518a785..a7f5f97 100644 --- a/general-patterns/single-var-pattern.html +++ b/general-patterns/single-var-pattern.html @@ -33,9 +33,23 @@ style = el.style; // do something with el and style... } + + // Preferred way + // Move commas BEFORE vars + // You'll not forget to add one when adding variable to the end of list + function func() { + var a = 1 + , b = 2 + , sum = a + b + , myobject = {} + , i + , j; + + // function body... + } // References // http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/ - \ No newline at end of file +