Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Javascript, what does the reserved keyword "short" do?

I'm merely trying to find the definition and usage of the key word, short, in JavaScript. I do not care about backwards compatibility and the likes, as to say that I don't want responses as to if, how, and why it may be an up to date syntax. I just want the definition. A Simple example would be best. Thank you.


1 Answers

They belong to the so-called future keywords by the ECMAScript specification.

They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers.

short as a reserved word was part of an old ECMAScript specification:

The following are reserved as future keywords by older ECMAScript specifications (ECMAScript 1 till 3)
[...] short [...]

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords

In ECMAScript 5/6 short was removed from the list of reserved words. Nonetheless for compatibility with older browsers not implementing either, you shouldn't use it anyway.

like image 105
connexo Avatar answered Sep 19 '25 00:09

connexo