1if(document.getElementById("myElmentID").classList.contains("hidden")){
2// I have the 'hidden' class
3}
1function whatIsInAName(collection, source) {
2 // "What's in a name? that which we call a rose
3 // By any other name would smell as sweet.”
4 // -- by William Shakespeare, Romeo and Juliet
5 var srcKeys = Object.keys(source);
6
7 return collection.filter(function(obj) {
8 return srcKeys.every(function(key) {
9 return obj.hasOwnProperty(key) && obj[key] === source[key];
10 });
11 });
12}
13
14// test here
15whatIsInAName(
16 [
17 { first: "Romeo", last: "Montague" },
18 { first: "Mercutio", last: null },
19 { first: "Tybalt", last: "Capulet" }
20 ],
21 { last: "Capulet" }
22);