<style>.min {
color: red;
}
.max {
color: green;
}
</style>
<table>
<tr>
<td>11</td>
<td>22</td>
<td>65</td>
<td>14</td>
<td>35</td>
</tr>
<tr>
<td>39</td>
<td>12</td>
<td>84</td>
<td>45</td>
<td>38</td>
</tr>
<tr>
<td>37</td>
<td>39</td>
<td>52</td>
<td>38</td>
<td>24</td>
</tr>
</table>
<script>
HTMLCollection.prototype.forEach = NodeList.prototype.forEach = Array.prototype.forEach;
var min, max, val;
var allTd = document.querySelectorAll('td');
allTd.forEach(function(el) {
val = +el.innerHTML;
if (!min) {
max = val;
min = val;
} else {
if (val > max) max = val;
if (val < min) min = val;
}
});
allTd.forEach(function(el) {
val = +el.innerHTML;
if (val === min) el.className = 'min';
if (val === max) el.className = 'max';
});
</script>
в 2 прохода