Normally when I get the value of a form input with jQuery I am obliged to convert it to a number before performing any mathematical operations. For instance, using the unary plus operator to convert, and then increment:
var x = +$(this).val();
x += 1;
But for some reason ++
works with strings and does the conversion automatically:
var x = $(this).val();
x++;
Why? Is this always safe?