0

Of these two, only gidden() works.

<span onclick="hidden()">hello</span>
<span onclick="gidden()">world</span>

<script type="text/javascript"><!--
    function hidden() {
         alert("hello");
    }
    function gidden() {
         alert("world");
    }
--></script>

Is hidden() a reserved function of javascript? Cause that is the only thing I can think of for this to make sense. If so, what does it do?

tschwab
  • 1,056
  • 1
  • 12
  • 27

1 Answers1

1

Yes, It is a reserved word. You'd better avoid the following identifiers as names of JavaScript variables. These are predefined names of implementation-dependent JavaScript objects, methods, or properties.

here is the list of all JavaScript Reserved Words

Hope this helps.

talha2k
  • 24,937
  • 4
  • 62
  • 81
  • Hmm that's odd. Thanks though. – tschwab Jul 26 '12 at 05:34
  • But do you know what `hidden` is for? In FF `typeof hidden` returns "undefined", where `typeof someotherthingsfromthatlist` will return "object" or "function". I guess given that `checkbox` and `radio` are also on that list `hidden` is in the same category as them? – nnnnnn Jul 26 '12 at 05:37
  • Well, no, it's not a *reserved* word. It's a word with special meaning in some JS implementations. It's not the same - most(?) reserved words will throw an error if you try to use it as a variable name, for example. – nrabinowitz Jul 26 '12 at 05:37
  • According to this: http://javascript.about.com/od/reference/g/shidden.htm Its not a reserved word, but usually all the names of predefined Classes and Objects are considered as reserved. and should not be used as variable or function names. – talha2k Jul 26 '12 at 05:54
  • There should be a difference between `Hidden` and `hidden` shouldn't there? I mean, that... almostreservedword shouldn't interfere with my function because of the case change. – tschwab Jul 26 '12 at 06:14