Is it possible to have integer array in jquery

javascript, jquery

Solution

You could do like this:

var ToothSequence = $("#hndBridge").val().split("|").map(function(e) { return +e; });

`+e` will convert `e` to a number.

--for old browser which Array doesn't have map method, use `$.map` instead--

var ToothSequence = $.map($("#hndBridge").val().split("|"), function(e) { return +e; });

Problem

I have `ToothSequence` array which contains all integer type values Whenever i want to compare the element or add integer i have to `parseInt` is as shown `parseInt(ToothSequence[i]) + 1` ``` var ToothSequence = $("#hndBridge").val().split("|"); for (i = 1; i <= ToothSequence.length; i++) { if (parseInt(ToothSequence[i]) + 1 == parseInt(ToothSequence[i + 1])) { ``` Is it possible to make integer array in jquery? if not please suggest me

Original source

Related problems