mardi 2 août 2016

Cannot check for an equal number using string

I have what I thought would be a simple logic check. In my code

$scope.seatMap.PlaneTypeCode = "175"

However, when I set

$scope.seatMap.PlaneTypeCode === "175" //my debugger returns <b>false </b>

parseInt($scope.seatMap.PlaneTypeCode,10) ===175  // equals 17

I added a few zeros on the radix but that did nothing to help.

I am not sure how to do a comparison check. Any insight on this would be hugely appreciated.

Here is my full if statement

if (parseInt(col.name,10) ===4 && parseInt($scope.seatMap.PlaneTypeCode,10) ===175 && $scope.TripSummary) {
       col.available = false;
    }

Aucun commentaire:

Enregistrer un commentaire