-
-
Save zer09/6b6b0b7f2752e71453afc9dd5633e978 to your computer and use it in GitHub Desktop.
Revisions
-
isaacs revised this gist
Sep 18, 2011 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -203,7 +203,8 @@ var a = "ape eat banana", // Error: Can't call method 'forEach' of undefined. // not passing in undefined as an argument!?? mergeLists([ apple, [ penelope, granger ] ], [ fun ], [ 1, 2, 3, 4, 5, 6, 7, 8 ] [ "mary's store has many pies, and cookies, and eggs," ] [ function() { doSomething() } ]); -
isaacs revised this gist
Sep 18, 2011 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -190,6 +190,7 @@ doSomething( aPrettyLongVariableName // Addendum 3: More realistic error in standard style: // leaks FIVE globals! var a = "ape eat banana", b = "bat, allowed to fly", c = "cat toy", @@ -200,7 +201,9 @@ var a = "ape eat banana", h = "hat goes on your head", i = "ibu isn't a cow"; // Error: Can't call method 'forEach' of undefined. // not passing in undefined as an argument!?? mergeLists([ apple, [ penelope, granger ], [ fun ], [ 1, 2, 3, 4, 5, 6, 7, 8] [ function() { doSomething() } ]); -
isaacs revised this gist
Sep 18, 2011 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -187,3 +187,20 @@ doSomething( aPrettyLongVariableName , { a: "is for antelope", b: "is for bat" } , 42 ) // Addendum 3: More realistic error in standard style: var a = "ape eat banana", b = "bat, allowed to fly", c = "cat toy", d = "dog chasing the mailman," e = "elf lord", f = "fly through the air", g = "gnu is not unix", h = "hat goes on your head", i = "ibu isn't a cow"; mergeLists([ apple, [ penelope, granger ], [ fun ], [ 1, 2, 3, 4, 5, 6, 7, 8] [ function() { doSomething() } ]); -
isaacs revised this gist
May 16, 2010 . 1 changed file with 12 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -167,10 +167,9 @@ return // then creates a block with two named statements. // this is ok: return ( 1 , 2 ) // returns 2 // so is this: return ( @@ -179,3 +178,12 @@ return ( } ) // returns {a:"ape",b:"bat"} // Addendum 2: A function call doSomething( aPrettyLongVariableName , "A string, which has some useful information" , "If you put these all together, it'd be too long" , { a: "is for antelope", b: "is for bat" } , 42 ) -
isaacs revised this gist
Apr 8, 2010 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ // See comments below. // This code sample and justification brought to you by // Isaac Z. Schlueter, aka isaacs // standard style var a = "ape", b = "bat", -
isaacs revised this gist
Apr 8, 2010 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -144,7 +144,8 @@ return { a : "ape" , b : "bat" } // returns {a:"ape",b:"bat"} // even just separating two values by commas is fine, // though a bit silly return 1 , 2 , 3 @@ -159,7 +160,8 @@ return return { a : "ape" , b : "bat" } // returns undefined, // then creates a block with two named statements. // this is ok: return ( -
isaacs revised this gist
Apr 8, 2010 . 1 changed file with 43 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -131,3 +131,46 @@ var o = [ "gnu", "hat" ] , [ "ibu" ] ]; // Addendum: effects on the return statement. // It does not break. return [ 1 , 2 , 3 ] // returns [1,2,3] return { a : "ape" , b : "bat" } // returns {a:"ape",b:"bat"} // even just separating two values by commas is fine, though a bit silly return 1 , 2 , 3 , 4 // returns the last value, 4 // this, however is wrong: return 1 , 2 // returns undefined, because of semicolon-insertion. // so is this. otb == fail. return { a : "ape" , b : "bat" } // returns undefined, then creates a block with two named statements. // this is ok: return ( 1 , 2 ) // returns 2 // so is this: return ( { a : "ape" , b : "bat" } ) // returns {a:"ape",b:"bat"} -
isaacs revised this gist
Apr 7, 2010 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ // See comments below. // standard style var a = "ape", -
isaacs revised this gist
Apr 6, 2010 . 1 changed file with 86 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,3 +44,89 @@ var a = "ape" , h = "hat" , i = "ibu" ; // Objects: // JSON.stringify style var o = { a : "ape", b : "bat", c : "cat", d : "dog", e : "elf", f : "fly", g : "gnu", h : "hat", i : "ibu" }, a = [ [ "ape", "bat" ], [ "cat", "dog" ], [ "elf", "fly" ], [ "gnu", "hat" ], [ "ibu" ] ]; // comma-first var o = { a : "ape" , b : "bat" , c : "cat" , d : "dog" , e : "elf" , f : "fly" , g : "gnu" , h : "hat" , i : "ibu" } , a = [ [ "ape", "bat" ] , [ "cat", "dog" ] , [ "elf", "fly" ] , [ "gnu", "hat" ] , [ "ibu" ] ]; // errors in objects: // JSON.stringify style var o = { a : "ape", b : "bat", c : "cat", d : "dog" e : "elf", f : "fly", g : "gnu", h : "hat", i : "ibu" }, a = [ [ "ape", "bat" ], [ "cat", "dog" ], [ "elf", "fly" ] [ "gnu", "hat" ], [ "ibu" ] ]; // comma-first var o = { a : "ape" , b : "bat" , c : "cat" , d : "dog" e : "elf" , f : "fly" , g : "gnu" , h : "hat" , i : "ibu" } , a = [ [ "ape", "bat" ] , [ "cat", "dog" ] , [ "elf", "fly" ] [ "gnu", "hat" ] , [ "ibu" ] ]; -
isaacs created this gist
Apr 6, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ // standard style var a = "ape", b = "bat", c = "cat", d = "dog", e = "elf", f = "fly", g = "gnu", h = "hat", i = "ibu"; // comma-first style var a = "ape" , b = "bat" , c = "cat" , d = "dog" , e = "elf" , f = "fly" , g = "gnu" , h = "hat" , i = "ibu" ; // error in standard style var a = "ape", b = "bat", c = "cat", d = "dog" e = "elf", f = "fly", g = "gnu", h = "hat", i = "ibu"; // error in comma-first style var a = "ape" , b = "bat" , c = "cat" , d = "dog" e = "elf" , f = "fly" , g = "gnu" , h = "hat" , i = "ibu" ;