We are still actively working on the spam issue.

Difference between revisions of "JavaScript"

From InstallGentoo Wiki
Jump to: navigation, search
m (fixed librejs redlink)
(need a shower, i haven't listed all the es6 features yet)
Line 2: Line 2:
 
[[File:Js.png|thumb|"Unofficial" logo.]]
 
[[File:Js.png|thumb|"Unofficial" logo.]]
  
'''JavaScript''' (or ECMAScript) is a styling language designed for use in the Netscape web browser, but later became a web standard. Javascript was originally used to stylize web pages in a way much like [[CSS]], but in recent years people have been using it as if it were an actual programming language. Creator Brendan Eich has been quoted as saying that Javascript "had to ‘look like Java’ only less so, be Java's dumb kid brother or boy-hostage sidekick. Plus, it had to be done in ten days or something worse than JavaScript would have happened."
+
'''JavaScript''' (or ECMAScript) is a scripting language that was originally designed for use in the Netscape web browser, but later became a web standard. JavaScript has traditionally been confined to the browser to add interactivity to web pages, but in recent years has been adopted for use in desktop applications (through technologies such as GJS and Electron) and for server-side use (Node.js, Rhino).
  
The language was originally named ECMAscript (and is still referred to as that by some), but was renamed JavaScript due to trademark disputes by [[Sun Microsystems]].
+
Creator Brendan Eich has been quoted as saying that Javascript "had to ‘look like Java’ only less so, be Java's dumb kid brother or boy-hostage sidekick. Plus, it had to be done in ten days or something worse than JavaScript would have happened."
  
== Controversy ==
+
The language was originally named LiveScript, renamed to JavaScript before release, and is referred to as ECMAScript for the purposes of standardisation.
Many people hate Javascript. When it began, it was just a neat sort of thing that allowed pages to be animated. However, later on (for a number of reasons, including the failed web 2.0 philosophy), Javascript became a primary element of [[RUE]] websites, causing a page that only needs 1mb at most to be 40mb in Javascript.  
 
  
Security risks in Javascript are extensive. Javascript can also be used to make a [[Malware | keylogger]]. This is used on many websites.
+
== Criticism ==
 +
=== Bloat ===
 +
Many people hate JavaScript. When it began, it was just a neat sort of thing that allowed pages to be animated. However, later on for a number of reasons, including the rise of Web 2.0, JavaScript became a primary element of [[RUE]] websites, causing a page that would otherwise be 1MB long in memory and transmission terms to be 40MB with JavaScript.
  
The fact that Javascript later evolved into a programming language prompted the [[FSF]] to give a guideline for adding software licenses to Javascript code, after [[Richard Stallman]] wrote an article called [https://www.gnu.org/philosophy/javascript-trap.html The Javascript Trap]. [https://www.gnu.org/software/librejs/manual/librejs.html LibreJS] is a web plugin designed by the FSF to block [[non-free]] javascript.
+
=== The language itself ===
 +
JavaScript as a language is quite unsound. Possibly as a result of the language originally being written within 10 days, for a very long time JavaScript only had simple function-level scoping, instead of lexical scoping (within blocks) used by almost every other popular programming language (bar the Bourne shell and Emacs Lisp). JavaScript's typing behaviour is clumsy, making many insane coercions between types compared to saner dynamic/duck typed languages such as Python; this problem led to new <tt>===</tt> and <tt>!==</tt> equality operators that only allow comparison between two values of the same type. JavaScript also has no standard library; it relies on the often disparate APIs in browsers (or Node), contributing to the cross-browser incompatiblity mess.
 +
 
 +
==== ECMAScript 6+ ====
 +
In recent years, there has been a new initiative to add missing features to the language and fix some of it's problems. Previously these efforts were hampered by Microsoft, but in 2015 ECMAScript 6 was finally finished and standardised (but not all of it's features have found their way into browsers yet).
 +
 
 +
These include:
 +
* Lexical scoping - ECMAScript 6 introduces two new keywords, <tt>let</tt> and <tt>const</tt> to replace <tt>var</tt>, as such:
 +
<nowiki>let x = 1
 +
{
 +
  x = 2
 +
  console.log(x)
 +
}
 +
console.log(x)
 +
> 2
 +
> 1</nowiki>
 +
* <tt>const</tt> uses the same scoping rules as <tt>let</tt>, but makes that identifier unable to be assigned to another value.
 +
 
 +
=== Security ===
 +
Security risks in JavaScript are extensive, through flaws in the language and exploits in JavaScript runtimes. JavaScript can also be used to make a [[Malware | keylogger]].
 +
 
 +
=== Software freedom ===
 +
The method in which JavaScript is executed upon page load without the user's consent is an affront to software freedom - [https://www.gnu.org/philosophy/javascript-trap.html the Javascript Trap]. [https://www.gnu.org/software/librejs/manual/librejs.html LibreJS] is a web plugin designed by the FSF to block [[non-free]] JavaScript.
  
 
[[Category:Programming languages]]
 
[[Category:Programming languages]]

Revision as of 13:11, 2 September 2016

"Unofficial" logo.

JavaScript (or ECMAScript) is a scripting language that was originally designed for use in the Netscape web browser, but later became a web standard. JavaScript has traditionally been confined to the browser to add interactivity to web pages, but in recent years has been adopted for use in desktop applications (through technologies such as GJS and Electron) and for server-side use (Node.js, Rhino).

Creator Brendan Eich has been quoted as saying that Javascript "had to ‘look like Java’ only less so, be Java's dumb kid brother or boy-hostage sidekick. Plus, it had to be done in ten days or something worse than JavaScript would have happened."

The language was originally named LiveScript, renamed to JavaScript before release, and is referred to as ECMAScript for the purposes of standardisation.

Criticism

Bloat

Many people hate JavaScript. When it began, it was just a neat sort of thing that allowed pages to be animated. However, later on for a number of reasons, including the rise of Web 2.0, JavaScript became a primary element of RUE websites, causing a page that would otherwise be 1MB long in memory and transmission terms to be 40MB with JavaScript.

The language itself

JavaScript as a language is quite unsound. Possibly as a result of the language originally being written within 10 days, for a very long time JavaScript only had simple function-level scoping, instead of lexical scoping (within blocks) used by almost every other popular programming language (bar the Bourne shell and Emacs Lisp). JavaScript's typing behaviour is clumsy, making many insane coercions between types compared to saner dynamic/duck typed languages such as Python; this problem led to new === and !== equality operators that only allow comparison between two values of the same type. JavaScript also has no standard library; it relies on the often disparate APIs in browsers (or Node), contributing to the cross-browser incompatiblity mess.

ECMAScript 6+

In recent years, there has been a new initiative to add missing features to the language and fix some of it's problems. Previously these efforts were hampered by Microsoft, but in 2015 ECMAScript 6 was finally finished and standardised (but not all of it's features have found their way into browsers yet).

These include:

  • Lexical scoping - ECMAScript 6 introduces two new keywords, let and const to replace var, as such:
let x = 1
{
  x = 2
  console.log(x)
}
console.log(x)
> 2
> 1
  • const uses the same scoping rules as let, but makes that identifier unable to be assigned to another value.

Security

Security risks in JavaScript are extensive, through flaws in the language and exploits in JavaScript runtimes. JavaScript can also be used to make a keylogger.

Software freedom

The method in which JavaScript is executed upon page load without the user's consent is an affront to software freedom - the Javascript Trap. LibreJS is a web plugin designed by the FSF to block non-free JavaScript.