Filter doubles

In this example below you will see how to do a Filter doubles with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by DanRom624, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright DanRom624 ©
  • HTML
  • CSS
  • JavaScript
    

/*Downloaded from https://www.codeseek.co/DanRom624/filter-doubles-mPYMYm */
    


/*Downloaded from https://www.codeseek.co/DanRom624/filter-doubles-mPYMYm */
    var isBigEnough = function(value) {
  return value >= 10;
}

var filtered = [12, 5, 8, 130, 44];
filtered = filtered.filter(isBigEnough);
console.log("filtered", filtered);

//
var testString = "There are 3 cats but 4 dogs.";
var expression = /\d+/g;

var digitCount = testString.match(expression);
console.log("digitCount", digitCount);
//

//
var expression = /(.)\1+/g;
var arr = ["aab", "Aab", "baa", "aba", "aba", "baa"];
var filteredArr = arr.filter(function(val) {
  return !val.match(expression);
});
console.log("filteredArr", filteredArr);

// filteredArr = [0, 42, true, false, NaN, "foo bar"]
//

//
var regex = /(.)\1+/g;
var filtered = permutations.filter(function(string) {
  return !string.match(regex);
});
//

var testArray = ["aab", "Aab", "baa", "aba", "aba", "baa"];
var expression2 = /aab/i;

newArray.filter(expression2);
//newArray = newArray.filter(expression2);
console.log("newArray", newArray);

/*
var filterDoubles = function(value) {
  return value = /aab/i;
}

var newArray = ["aab", "Aab", "baa", "aba", "aba", "baa"];
var matchArray = newArray.slice(0);

newArray = newArray.filter(filterDoubles);
console.log("newArray", newArray);


matchArray = matchArray.match(/aa/i);
console.log("matchArray", matchArray);
*/

Comments