Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorial17 Numbers: Integer
and Float
MDN: Numbers and Dates: Numbers
An Integer
is a number without a decimal—a
whole number—and a Float
is a number with a
decimal. All MIDI-specific values are handled as Integer
and most Scripter-specific values are handled as Float
.
var anInteger = 60;
var aFloat = 60.1;
When calculations are made between integers and floats, the result will always be a float.
var anInteger = 60;
var aFloat = 60.1;
var result = anInteger + aFloat; // 120.1, a float