In this case the value will be a string because under the hood, the data() jQuery method is calling the JavaScript getAttribute() method on the DOM element. And attribute values on HTML elements are string values and are returned as strings.

You can also look into the parseFloat() and parseInt() methods of JavaScript to force the conversion to a number.

JavaScript does not default things to string. It does support types, but it also doesn't enforce them unless you want it to. JavaScript will try to coerce types by inferring what you want. Like this:
var x = "2";var y = x + 2;console.log(y == 4); //logs true

JavaScript will coerce the string into a number and y will be the result. Similarly:
var i = 2;var k = i + "";

k will be a string value.

Types can seem to be very fluid, and JavaScript can coerce them in unexpected ways if you aren't careful. When you have logic that requires variables to be specific types, it's best to force them into the types you need.