Permalink
Browse files

flatten the array

  • Loading branch information...
tristen
tristen committed Nov 30, 2012
1 parent aad75c8 commit 1aac5af5d0e5ee621804acbaa97b6346373bf07c
Showing with 8 additions and 2 deletions.
  1. +8 −2 site.js
View
10 site.js
@@ -90,6 +90,7 @@ function newMarker() {
// fmonth is function that, creating a dinamics dates, in the wiev
function fmonth(f) {
+
//array aMonth for take moths from JSON
var aMonth = [];
// array de que se genera de la fecha
@@ -102,12 +103,17 @@ function fmonth(f) {
aMonth.push(aDate[1]); //push month in array aMoth
});
- aMonth = _.uniq(aMonth);
+ aMonth = _.chain(aMonth)
+ .uniq()
+ .compact()
+ .value();
+
aMonth = aMonth.sort();
+ console.log(aMonth);
//create a tag "li" and "a" with "id=aMonth[i]" for menu month in the view
for (var i = 0; i < aMonth.length; i++) {
- var new_li = document.createElement("li");
+ var new_li = document.createElement('li');
new_li.innerHTML = '<a href= \'#\' id=\'' + aMonth[i] + '\' > ' + monthNames[aMonth[i] - 1] + '</a>';
parent.appendChild(new_li);
}

0 comments on commit 1aac5af

Please sign in to comment.