May
Status
May
Apr
Most developers when using HTML inputs with type="number"
assume the input value will be a number, and get confused when the value is a string instead. This is because the type=“number” actually tells the browser that the input is used for numbers and to provide a number input UI with included built-in validation to reject non-numerical entries.
Now to get the number almost everyone will use the good old parser functions parseInt
/parseFloat
, like this:
parseInt(input.value, 10);
But, there is a less-known property called .valueAsNumber which allows us to avoid parseInt/parseFloat functions, for example:
input.valueAsNumber
How cool is that!
Apr
Since I’m on a short holiday and have plenty of free time I’ve decided to implement some new cool features on this blog that I’ve seen on Aaron’s blog, which are location and weather conditions when posting. This status post is just a test of the current implementation, which seem to work fine.