From 661cfe1e59d0afdc2f385e5696c7dd857ebdef0e Mon Sep 17 00:00:00 2001 From: Paul Tannenbaum Date: Sat, 25 Jan 2014 23:57:31 -0800 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38fdcb1474..aa8a5f8ad6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Airbnb JavaScript Style Guide() { +# Liftopia JavaScript Style Guide() { *A mostly reasonable approach to JavaScript* From a75ff1383bffec3ee5ba6525989fe0936a0b7e44 Mon Sep 17 00:00:00 2001 From: Paul Tannenbaum Date: Thu, 6 Feb 2014 23:04:55 -0800 Subject: [PATCH 2/2] updated how we wish to display multiple array items --- README.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aa8a5f8ad6..f3a16d0975 100644 --- a/README.md +++ b/README.md @@ -121,17 +121,29 @@ ## Arrays - - Use the literal syntax for array creation + - Use the literal syntax for array creation ```javascript // bad var items = new Array(); // good - var items = []; + var items = []; ``` - - - If you don't know array length use Array#push. + - Declare each new array item on a new line + + ```javascript + // bad + var items = ['foo', 'bar', 'bam'] + + // good + var items = ['foo', + 'bar', + 'bam'] + ``` + + + - If you don't know array length use Array#push. ```javascript var someStack = []; @@ -144,7 +156,7 @@ someStack.push('abracadabra'); ``` - - When you need to copy an array use Array#slice. [jsPerf](http://jsperf.com/converting-arguments-to-an-array/7) + - When you need to copy an array use Array#slice. [jsPerf](http://jsperf.com/converting-arguments-to-an-array/7) ```javascript var len = items.length, @@ -160,7 +172,7 @@ itemsCopy = items.slice(); ``` - - To convert an array-like object to an array, use Array#slice. + - To convert an array-like object to an array, use Array#slice. ```javascript function trigger() {