Hi lady6,
Yes, you can have an unused function in an error-free JavaScript
program. Nothing requires that a JavaScript function ever be called,
nor that there be something that calls it, whether executed or not.
This is consistent with the requirements for functions in most, if not
all, other programming languages.
A JavaScript interpreter will not object to an unused function, and
the function definition will not cause other script elements to
malfunction.
Conceivably, if you defined an unused function as an error, a script
with an unused function could not be error-free by definition, but I
guess you would not have asked the question if you were making that
assumption.
--efn |