Forum Moderators: open
<input type="number" value="0" id="input">
<script>
if (document.getElementById('input').value == 0) {
alert('Hello, world!');
}
</script>
Expected '===' and instead saw '=='.
== to ===, the alert stops appearing.
JSLint requires...
if (document.getElementById('input').value === '0')
How about input.value == '0'?
Am I right in my assumption that input.value == '0' is faster than input.value == 0 as the first one doesn't need a conversion?