Not sure how to get the filter to take two properties, so we can change the 'isNucleotide' function.
var nucleotides = {
DNA: ["A", "C", "G", "T"],
RNA: ["A", "C", "G", "U"],
chosenString: "abcdaaaa",
isNucleotide: function (value, nucleo) {
if (value === "A") {
return "A"
} else {
return null
}
},
countThis: function (string, nucleotide) {
var comparable = string.toUpperCase().split("");
var allNucleo = comparable.filter(nucleotides.isNucleotide);
return allNucleo.length
},
countAll: function (string) {
for (var i = 0; i < nucleotides.DNA.length; i++) {
console.log (nucleotides.countThis(string, nucleotides.DNA[i]))
};
}
}