Talk:JavaScript

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

No "criticism" section?[edit]

Your language is bad and you should feel bad. 74.192.154.198 (talk) 17:01, 27 July 2017 (UTC)[]

Agreed. IMO Javascript is the worst thing to happen to web/html EVER, a relic of the Word macrovirus era when every two-bit application had its own totally overpowered scripting language. The security issues mentioned are just the top of the iceberg, in addition comes the sheer annoyances, resource wastage and privacy issues JS enables. In most cases JS is nothing but techno-masturbation and complexity for complexity's own sake, implemented by developers primarily interested in protecting their own jobs, similar to how web pages constantly demands the newest browser to work while not having showed any tangible improvements in the last 10-15 years. It's a bit like if every book was a pop-up book (complete with animated elements, flashing lights and greeting-card style sound chips), it's time for developers to realize most web pages are documents and not applications, and shouldn't behave as such. — Preceding unsigned comment added by 85.166.186.36 (talk) 04:45, 6 March 2019 (UTC)[]
It is a fact that web-browsers, had practically became virtual machines doing all the work, with JavaScript playing the role of a systems programming language. The many unnecessary bells and whistles that cause the browsers to stall. That is not necessarily caused by malicious programmers, the few that I had learned about JavaScript point it as a very unsafe language, because it promote bad programming habits.
Although I agree with you in many points, this discussion page is not to talk about bad design of JavaScript. It is to discus on how to improve the article.
I suggest you to turn all your observations into a draft criticism section. They are valid and I support to include a reasoned criticism. It is a big challenge, because it is a highly passionate subject among programmers. — Preceding unsigned comment added by 201.124.237.242 (talk) 11:34, 25 December 2019 (UTC)[]

Javascript design in ten days source needed[edit]

Hello, can't find my credentials to logged in, but here is a source that shows that Javascript design (not the implementation) was rushed in ten days. https://thenewstack.io/brendan-eich-on-creating-javascript-in-10-days-and-what-hed-do-differently-today/ — Preceding unsigned comment added by 93.188.244.214 (talk) 09:33, 26 September 2019 (UTC)[]

The importance of Babel (or alternatives) to evolution of JS.[edit]

Hi folks, I'm not the right person to actually add content here, but upon reading the article, it seemed to leave out what has allowed JavaScript to evolve - that is the existence of JavaScript compilers (is that the right word) like Babel. My understanding is as follows:

  • Developers will never use a feature of a language that isn't supported by most browsers. This would, automatically, include any 'new' feature of a language like all those introduced in ES5, 6, 7 and 8.
  • Because of this web page developers were required to use the most primitive version of JavaScript supported by the browsers they were targeting.
  • Because of the existence of JS compilers like Babel, folks developing new ideas for JS can implement those features and make them available to anyone who wants to try them out, without any dependencies on browser adoption. This is because the JS compiler can, before the code leaves the developers environment, convert it into plain common JS.
  • Because of the existence of JavaScript compilers like Babel, folks who want to use these newest language feature, both experimental features and ultimately, features that have been made part of new specifications, can freely use those in their development. After making sure the appropriate plug-ins are installed in their Babel system the JS will be converted into the simplest syntax supported by all browsers.

This seems really critical to me. Imagine if you had to work with Google, Mozilla, and Microsoft to convince them to support a new JS feature before it could be used in a web page. Then you'd have to wait until all the old versions of the browsers were deprecated. Evolution of the language would not occur. The existence of JS compilers has made the rapid evolution of JS possible and it seems like that should be in the content of this page. TomClement (talk) 01:04, 23 November 2019 (UTC)[]

Babel is just one of the transpilers available these days. The role of transpilers is covered in the article, with a ref that has a comprehensive list, including Babel. -Pmffl (talk) 16:09, 24 February 2020 (UTC)[]

edit warring about JS being classified as an interpreted language[edit]

The last few days have seen some edit warring here about JS being classified as an interpreted language. I'm surprised there is disagreement on this point. As I noted yesterday, just-in-time compilation is really an optimization of interpretation.

JIT has been in use for over a decade, and client-side JS code is still downloaded from servers as human-readable source that has to be converted into machine code by the browser's JS engine. That's conversion at runtime, i.e. interpretation. The fact that JIT makes it considerably faster, on average, has been a really nice optimization; but googleapis.com, cloudflare.com, etc. are still serving up jQuery in source form. That hasn't changed.

I'd like to get consensus on this point here. I skimmed the talk archives and didn't see any threads on this particular point. Perhaps there are other ways of classifying this that I'm unaware of. -Pmffl (talk) 16:20, 24 February 2020 (UTC)[]

I spent some time googling this issue, and now I better understand that this has been a lingering source of confusion for some people, including developers. The labels "interpreted" and "compiled" were established by the 1970s, decades before hardware was powerful enough for ideas like JIT to become a practical reality. Back then there was a clear separation of languages compiled by a developer, e.g. Fortran and C, and delivered as an executable binary, from others like Lisp and Scheme that were always delivered as source. So that's why my own concept of "interpreted" focuses on the mechanism of delivery. (As do others, like here.)
Since this is not such a cut-and-dry classification, I removed the "interpreted" label from the lede sentence of the article. -Pmffl (talk) 15:40, 25 February 2020 (UTC)[]

Mistake in "Weakly typed" table[edit]

The "Quirks" table contains a mistake not supported by either of the two cited references. Namely, the result of [] + {} is not {} but rather '[object Object]' (a string). This can also be verified by trying it in a modern REPL. When I tried to correct this the edit was rejected. What can I do better in the future?

--Lagewi (talk) 23:20, 9 March 2020 (UTC)[]

I tested it in the Chrome Console (Ctrl Shift I) and it turns out to be correct. It seems like the [] is an empty string, and {} is "[Object object]" - i've updated the table. (Link for testing: https://js.do/code/428766)
(As for what you should've done, maybe use the edit summary to explain?)  AltoStev Talk 00:00, 16 April 2020 (UTC)[]
Edit: Oops, it seems like you've already made the change. Nevermind AltoStev Talk 00:04, 16 April 2020 (UTC)[]

Paragraph 3[edit]

JS is a programming language that conforms to the ECMAScript specification.

(Different web browsers and also Node) each have different implementations of ECMAScript, where each implementation is a variant of JavaScript.

To conform to the ECMAScript specification, (reference: https://tc39.es/ecma262/#sec-conformance), an implementation must provide all of the features of ECMAScript, but can also "provide additional types, values, objects, properties, and functions beyond those described in [the] specification"

Paragraph 3 says: "However, the language itself does not include any input/output (I/O), such as networking, storage, or graphics facilities, as the host environment (usually a web browser) provides those APIs."

EMCAScript is the language that doesn't define any APIs for such, but browsers add functionality onto that as their version of JavaScript.
JavaScript includes the functionality, "the language itself" is actually ECMAScript, but the sentence in paragraph 3 is misleading and refers to JS instead of ECMAScript.  AltoStev Talk 00:20, 22 December 2020 (UTC)[]

I just rewrote it as a separate paragraph:
"The ECMAScript standard does not include any input/output (I/O), such as networking, storage, or graphics facilities. In practice, the web browser or other runtime system provides JavaScript APIs for I/O."
-Pmffl (talk) 22:43, 29 January 2021 (UTC)[]

Better Example than Animations[edit]

CSS3, SASS, SCSS, and LESS can all animate content without scripts. I think a better example should be provided so that people better understand what these languages can do. I.e "make a popup." DukeOfGrammar (talk) 19:11, 8 April 2021 (UTC)[]

I don't see this as a problem. Just because there's an alternate way to do page animations, doesn't invalidate the example of JS doing it. But good suggestion about pop-ups. I added that to the list. -Pmffl (talk) 17:12, 9 April 2021 (UTC)[]

Syntax - variadic function demonstration[edit]

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments says "If you're writing ES6 compatible code, then rest parameters should be preferred." So maybe replace or add a rest param example.  AltoStev Talk 12:58, 16 April 2021 (UTC)[]

oppose - @AltoStev: These tips aren't mandatory. It just makes easier to access a fraction of elements inside arguments. --AXONOV (talk) 10:09, 8 May 2021 (UTC)[]

JAVA elimination[edit]

I suggest to revert the following edits mentioning JAVA. These were illegally removed by Pmffl. It should be mentioned per WP:LEAD.

  • 17:04, May 12, 2021 - «‎Creation at Netscape: wording»
  • 16:42, May 12, 2021 - «Restored revision 1022595329 by ClueBot NG talk): Full vandal revert»
  • 22:49, April 12, 2021 - «remove Java comparison from lede - covered in the hat, the history, and a dedicated section»
  • 07:26, April 12, 2021 - «Undid revision 1017339785 by 87.55.214.141 talk) junk edit - wrong section and Node already covered»

--AXONOV (talk) 19:26, 14 May 2021 (UTC)[]

What do you mean by 'illegally removed'? Those are totally normal edits. One of them is restoring half a sentence that was deleted by an IP vandal. - MrOllie (talk) 23:29, 14 May 2021 (UTC)[]
@MrOllie: See MOS:INTRO#summarize. The JAVA is discussed in the body. No reason to remove it from lead. AXONOV (talk) 08:58, 15 May 2021 (UTC)[]
There are valid reasons to remove it, as I stated in my edit comment. Two more: the body of the Java article doesn't even mention JS at all, and it's best to not bloat the lede of this article. -Pmffl (talk) 12:46, 16 May 2021 (UTC)[]
I'd strongly argue that it belongs in the lede. It's a frequent source of confusion to people unfamiliar with the languages, and its prominently mentioned in the Mozilla Developer Network page on Javascript here. One of the most popular Javascript books "Eloquent Javascript," also mentions it in the second paragraph of the into here. OhNoitsJamie Talk 17:43, 17 May 2021 (UTC)[]
I think the hatnote alone is probably good enough, as it is now it seems a bit redundant. - MrOllie (talk) 18:34, 17 May 2021 (UTC)[]
@Ohnoitsjamie: It's fair point to mention Java. We have to follow WP:INTRO anyway. And moreover, there is a whole website devoted to JAVASCRIPT IS NOT A JAVA[1]. To say nothing of the books: [2][3] AXONOV (talk) 18:52, 17 May 2021 (UTC)[]