From b72c4b1f9137dc39ed24ce0fb85aa9a8a1aecd62 Mon Sep 17 00:00:00 2001 From: nhducit Date: Sat, 19 Mar 2016 22:50:31 +0700 Subject: [PATCH 1/7] Update information about default radix --- general-patterns/parseint.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/general-patterns/parseint.html b/general-patterns/parseint.html index e29ebe2..f451cf3 100644 --- a/general-patterns/parseint.html +++ b/general-patterns/parseint.html @@ -24,13 +24,17 @@ // pattern 2 /* NOTE: if you're expecting input such as “08 hello”, parseInt() will return a number, whereas the others will fail * with NaN. + If the input string begins with "0", radix is eight (octal) or 10 (decimal). + Exactly which radix is chosen is *implementation-dependent*. + ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet. For this reason always specify a radix when using parseInt. */ +"08" // result is 8 Number("08") // 8 // References + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt // http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/ - \ No newline at end of file + From 995b3ec8c072c6adc91b10a1f26b6da9a7e6c73f Mon Sep 17 00:00:00 2001 From: Gleb Radutsky Date: Sun, 20 Mar 2016 13:06:45 -0400 Subject: [PATCH 2/7] Removed misplaced/uneeded code --- general-patterns/conditionals.html | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/general-patterns/conditionals.html b/general-patterns/conditionals.html index a13fac0..8c5a34e 100644 --- a/general-patterns/conditionals.html +++ b/general-patterns/conditionals.html @@ -36,30 +36,6 @@ /* alternative method 3 - binary-search-like approach * This approach is best when there are ranges of values for which to test */ - if (value == 0) { - return result0; - } else if (value == 1) { - return result1; - } else if (value == 2) { - return result2; - } else if (value == 3) { - return result3; - } else if (value == 4) { - return result4; - } else if (value == 5) { - return result5; - } else if (value == 6) { - return result6; - } else if (value == 7) { - return result7; - } else if (value == 8) { - return result8; - } else if (value == 9) { - return result9; - } else { - return result10; - } - if (value < 6) { if (value < 3) { if (value == 0) { From 2780995797bc000c330193997127909c8f3bc5a0 Mon Sep 17 00:00:00 2001 From: nhducit Date: Mon, 21 Mar 2016 11:13:06 +0700 Subject: [PATCH 3/7] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bd42efc..17cb446 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,5 @@
Project page at: http://shichuan.github.com/javascript-patterns +#TODO: +- [ ] Create new github page for this repository From 54dd5a7a03062f382ddd2e473e28f16b58095e13 Mon Sep 17 00:00:00 2001 From: Rob Larsen Date: Sat, 9 Apr 2016 09:09:08 -0400 Subject: [PATCH 4/7] Updating the readme to explain this new fork --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17cb446..d9fff23 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ JS Patterns
-Project page at: http://shichuan.github.com/javascript-patterns + +Hi all. This repo aims to revive and revitalize the javascript-patterns project. The original project has been dormant for several years and instead of letting such a valuable resource wither away completely, [the community has decided to try to take on the project and bring it back to life](https://github.com/shichuan/javascript-patterns/issues/154). + +Original project page at: http://shichuan.github.com/javascript-patterns -#TODO: -- [ ] Create new github page for this repository From 1d1c71335e388789fdda258642bc2938e7a249bf Mon Sep 17 00:00:00 2001 From: Peter Keller Date: Sun, 11 Dec 2016 11:29:48 -0500 Subject: [PATCH 5/7] Updating the readme to explain this new fork --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 17cb446..d9fff23 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ JS Patterns
-Project page at: http://shichuan.github.com/javascript-patterns + +Hi all. This repo aims to revive and revitalize the javascript-patterns project. The original project has been dormant for several years and instead of letting such a valuable resource wither away completely, [the community has decided to try to take on the project and bring it back to life](https://github.com/shichuan/javascript-patterns/issues/154). + +Original project page at: http://shichuan.github.com/javascript-patterns -#TODO: -- [ ] Create new github page for this repository From 39bd6780abe3f2ea5bf3f961c0b1fcbdd8714ecd Mon Sep 17 00:00:00 2001 From: Peter Keller Date: Sun, 11 Dec 2016 11:30:28 -0500 Subject: [PATCH 6/7] iife loop --- general-patterns/iife-for-loop.html | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 general-patterns/iife-for-loop.html diff --git a/general-patterns/iife-for-loop.html b/general-patterns/iife-for-loop.html new file mode 100644 index 0000000..dbc91ea --- /dev/null +++ b/general-patterns/iife-for-loop.html @@ -0,0 +1,40 @@ + + + + JavaScript Patterns + + + + + + \ No newline at end of file From 21ee57f7574ed120108761a5635f6d1d5f0fefe4 Mon Sep 17 00:00:00 2001 From: Peter Keller Date: Sun, 4 Mar 2018 20:22:10 -0500 Subject: [PATCH 7/7] Map and Filter By Reduce --- .../map-and-filter-by-reduce.html | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 general-patterns/map-and-filter-by-reduce.html diff --git a/general-patterns/map-and-filter-by-reduce.html b/general-patterns/map-and-filter-by-reduce.html new file mode 100644 index 0000000..0c5f918 --- /dev/null +++ b/general-patterns/map-and-filter-by-reduce.html @@ -0,0 +1,45 @@ + + + + JavaScript Patterns + + + + + + \ No newline at end of file