Arithmetic in the JavaScript interpreter is basically floating point although many values will be integers. If a numeric value is output then it will automatically be truncated to an integer if there is no fractional part. There are several functions and operators available for explicitly converting floating point values to integer values:
Math.abs() function
Math.ceil() function
Math.floor() function
Math.round() function
% Remainder
%= Remainder and assign to an LValue
Prev | Home | Next |
Integer | Up | Integer constant |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |