javascriptemacsexternaljs2-mode

What does "extern" mean in JavaScript?


I just started to use js2-mode in Emacs, and I found some variables like js2-global-externs and js2-additional-externs. The doc string says it is "A list of any extern names you'd like to consider always declared."

I don't understand what "extern" means here. I only knew the "extern" keyword in C, so I started to discover what "extern" means. I searched JavaScript extern/Ecma-262 extern/web browser extern but didn't get anything that looked promising. Can anyone point me in the right direction?


Solution

  • The extern keyword has nothing to do with JavaScript. It's some configuration on which js2-mode relies on to define the language.

    For instance, I believe that you could add your own global variables js2-global-externs so that they get recognized.

    Have a look at this file https://code.google.com/p/js2-mode/source/browse/trunk/js2-externs.el?r=57