Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorial13 const
MDN: Grammar and types: Constants
If there is a value which is read-only (it needs to never change),
then the const
keyword is used, short for “constant”.
Constants are typically in all caps to make them easy to identify.
const MIDDLE_C = 60;
Scripter will throw an error if there is a re-assignment of the
variable middle_c
:
const MIDDLE_C = 60;
= 0; MIDDLE_C
***Creating a new MIDI engine with script***
Evaluating MIDI-processing script...
Script failed to evaluate:
[JS Exception] TypeError: Attempted to assign to readonly property. line:2
>