const
testFunction = val => Number(val)===val
, values =
[ { v: 123, display: `123`, expected: true }
, { v: '123', display: `"123"`, expected: false }
, { v: NaN, display: `NaN`, expected: false }
, { v: undefined, display: `undefined`, expected: false }
, { v: null, display: `null`, expected: false }
]
, tBody = document.querySelector('table > tbody')
;
let score = 0
;
for (let {v, display, expected} of values)
{
let
TR = tBody.insertRow()
, res = testFunction(v)
;
score += expected===res ? 1 : 0
TR.insertCell().textContent = display
TR.insertCell().textContent = expected
TR.insertCell().textContent = res
TR.insertCell().className = expected===res ? 'ok' : 'bad'
}
document.querySelector('table >tfoot td:nth-of-type(2)')
.textContent = `${score} / ${values.length}`
table { font-family: Arial, Helvetica, sans-serif;border-collapse: collapse;margin: 0 1em; }
td { padding: .2em .8em;border: 1px solid darkblue; }
thead,tfoot { background-color: #84a4ce;text-transform: capitalize; }
caption { padding: .3em;caption-side: bottom;font-size: .8em; }
.ok:before,.bad:before { font-weight: bold;font-size: 1.2em; }
.ok:before { color: green;content: '\2713'; }
.bad:before { color: red; content: '\2718'; }
<table>
<caption>( Number(val)===val ) ?</caption>
<thead>
<tr> <td>val</td><td>expected</td><td colspan="2">result</td> </tr>
</thead>
<tbody></tbody>
<tfoot>
<tr> <td colspan="3">score</td><td>0/0</td> </tr>
</tfoot>
</table>