The code you wrote will function correctly. However when copied directly into an editor it will throw a “Cannot read property ‘value’ of null” error. For some reason there is an issue with the way your quotation marks are being rendered and its rendering characters that aren’t actual quotation marks. Try using single quotes:
<input type="number" value="1" id='velocityX'>
<script>
var x = document.getElementById('velocityX').value;
console.log(x)
</script>
heres a working codepen with what you’re asking for: https://codepen.io/anon/pen/NoXadZ?editors=1111
solved I can’t reach the value of the input [closed]