List Processing

Variation 2: more filtering

by GOLDENSWORD559

HTML

<script src="http://wilderland.org/javascript2/findDoubleDigitTest.js"></script>
<script src="http://wilderland.org/javascript2/filter.js"></script>
<div class='explanation'>
    The tests in this fiddle expect a function called "findTwoDigits". The tests will pass the function an array of numbers. The function should return an array with only the two-digit numbers from the original list.
<p>
    An easy way to tell if a number is a two-digit number is to check whether it's between 10 and 99 (inclusive).  Don't worry about fractions; all of the numbers in the test list will be integers (whole numbers).
</div>
<button>Click To Run Tests</button>
<div id=results></div>

CSS

.explanation {
    border: 1px solid #010310;
    border-radius: 10px;
    box-shadow: 2px 2px 3px rgba(12,10,30,0.3);
    margin: 10px 0 20px 5px;
    font-family: sans-serif;
    
    padding: 15px;
    width: 30em;
}

p {
  margin-top: 5px;
}

JavaScript

function findTwoDigits(list) {
    var result = filter(function(current) { return 9 < current && current < 100;}, list);
   
    return result;
}