Nan Replacement In Node.js With An Integer
I am using following code to update database in node.js var mBooking = rows[0]; var distance = mBooking.distanceTravelled; var lastLng = mBooking.lastLng; var lastLat = mBooking.la
Solution 1:
Use isNaN()
.
if (isNaN(distance))
distance = 0;
You can also condense this to one line with an inline-if:
distance = (isNaN(distance) ? 0 : distance);
Post a Comment for "Nan Replacement In Node.js With An Integer"