S
Simulacrom1
Is it better to use:
var hasDocumentLayers document.layers ? true : false;
and then use:
if( hasDocumentLayers ){....do something....}
Or it is better to always use
if( document.layers ){....do something....}
Also, which is faster? I'm thinking not having to index the document
class each time is faster - but if Javascript is pre-compiled into
something like pcode (or like Perl/PHP do it), then it might not matter
at all which way you did it because everything would have already been
looked up. If Javascript doesn't pre-compile and it interprets each
line as it gets to it, then I'm thinking the hasDocumentLayers would be
faster as it is only interpreted once and then just referenced
throughout the program.
Which?
var hasDocumentLayers document.layers ? true : false;
and then use:
if( hasDocumentLayers ){....do something....}
Or it is better to always use
if( document.layers ){....do something....}
Also, which is faster? I'm thinking not having to index the document
class each time is faster - but if Javascript is pre-compiled into
something like pcode (or like Perl/PHP do it), then it might not matter
at all which way you did it because everything would have already been
looked up. If Javascript doesn't pre-compile and it interprets each
line as it gets to it, then I'm thinking the hasDocumentLayers would be
faster as it is only interpreted once and then just referenced
throughout the program.
Which?