javascriptkeyword

Why does my editor highlight `name` like a keyword? Is it one and what does it do?


When I typed this apparently innocent snippet of code:

values.name

gedit highlighted name as a keyword. However, name is not listed by the pages linked to by an answer to a question about reserved keywords. I also did a couple trivial tests in SpiderMonkey, but name seemed to act like an ordinary identifier.

A Google search didn't tell me much either. However, I did find a page listing name in "Other JavaScript Keywords". My guess is that name is a function or a member of some DOM element and does not intrude on the namespace.

Is name really a keyword in JavaScript? If so, what does it do?


Solution

  • Its not a javascript reserved word, its an html attribute. Any DOM element can have a name. Looks like your syntax editor will still highlight it.