Talk:JavaScript/Archive 6

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1 Archive 4 Archive 5 Archive 6

edit warring about JS being classified as an interpreted language

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

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

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

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

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

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)

Use semi-official logo as infobox icon

The infobox currently shows pure javascript code. I feel this is confusing to users who don't understand JavaScript or programming in general. Currently, the infobox also links as comment back to a 2013 talk thread with 2 people agreeing to remove the icon. I feel that now, this logo is way more standard and universal than ever.

Semi-official logo

— Preceding unsigned comment added by Moo12101 (talkcontribs) 05:54, 11 March 2022 (UTC)

Apologies for the incredibly late reply, but I 100% agree with you, it is almost universally accepted and recognized. If there aren't any objections I'll go ahead and switch it. ~ Eejit43 (talk) 03:48, 28 October 2022 (UTC)
Never mind, seems like a consensus was made in 2015 regarding this: Talk:JavaScript/Archive 5#Why is the unofficial logo present?
Might not be a bad idea to discuss this further, however, as the acceptance of the logo has changed since then.
If not, the icon should definitely be improved, the example code is quite unhelpful, and the usage of HTML just serves to be confusing. ~ Eejit43 (talk) 03:55, 28 October 2022 (UTC)

For post related to Javascript JSON array refer. https://astrophile0.space/javascript-json-array/ — Preceding unsigned comment added by Utka05 (talkcontribs) 09:02, 7 January 2023 (UTC)

Misleading infobox caption

Current revision as of writing [4]

The caption of the infobox image currently states "Screenshot of JavaScript source code" while the image definitely shows "JavaScript source code embedded in HTML".

172.218.5.205 (talk) 04:59, 28 April 2022 (UTC)

Syntax - "In HTML documents..." example

The example given for output in HTML documents previously said "In HTML documents, this program is required for an output", I changed this to (the awkwardly worded) "In HTML documents, a program like this is required for an output" so it no longer sounds like it would require this exact code, but the example still seems unclear and not well explained. In particular, the document.querySelector() examples at the end are presented as though they're part of the "Hello, World!" equivalent, but as far as I can tell they're not? AKiwiDeerPin (talk) 10:57, 28 July 2022 (UTC)

What is this

??? 96.64.125.69 (talk) 18:09, 28 October 2022 (UTC)

Do you have a specific question regarding this talk page or JavaScript itself? If the latter I'd suggest reading the article... ~ Eejit43 (talk) 03:02, 29 October 2022 (UTC)

Microsoft did not reverse-engineer javascript

In History/Adoption by Microsoft, we can read that "Microsoft did reverse-engineer javascript". As netscape source code was available, it cannot be true, as per the definition of "reverse engineering" of wikipedia. Having the source code of a language is not at all doing so "with very little (if any) insight into exactly how it does so". 2A01:CB14:601:A00:5B8F:DF2:C3E0:199E (talk) 22:03, 11 January 2023 (UTC)

Valid point. I removed that term in that section. -Pmffl (talk) 19:35, 15 March 2024 (UTC)

Semi-protected edit request on 17 March 2023

I have noticed some errors or mistakes in the article JavaScript and I want to correct them so I am requesting to get editing Access. Raja Abdul Rehman (talk) 09:25, 17 March 2023 (UTC)

 Not done: this is not the right page to request additional user rights. You may reopen this request with the specific changes to be made and someone may add them for you, or if you have an account, you can wait until you are autoconfirmed and edit the page yourself. Cannolis (talk) 09:31, 17 March 2023 (UTC)

Semi-protected edit request on 28 June 2023

This line: document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class Should be: document.querySelectorAll('.multiple'); // Returns an Array-like NodeList of all elements with the "multiple" class 108.28.68.152 (talk) 00:16, 28 June 2023 (UTC)

 Done MSDN agrees with you[1] Change made, thanks! TartarTorte 15:15, 29 June 2023 (UTC)

References

  1. ^ "Document: querySelectorAll() method - Web APIs | MDN". developer.mozilla.org. 7 April 2023. Retrieved 29 June 2023.

Server side usage

The current language, "JavaScript engines were originally used only in web browsers, but are now core components of some servers and a variety of applications," is misleading. JavaScript was almost immediately used in server-side applications with the introduction of LiveWire as an extension of Netscape Enterprise Server in 1996. Bob.Devereux (talk) 12:35, 9 March 2024 (UTC)

The lede fine the way it is. As stated in the Other usage section: "Initial attempts at promoting server-side JavaScript usage were Netscape Enterprise Server and Microsoft's Internet Information Services, but they were small niches. Server-side usage eventually started to grow in the late 2000s, with the creation of Node.js and other approaches." And "originally" was indeed the Navigator browser. So no changes needed. -Pmffl (talk) 01:15, 13 March 2024 (UTC)

new Criticism section?

As part of my spate of recent activity on this article, I archived the threads here, and in doing so came across an interesting old one. That, and the Eich quote I just added to the History section, reminded me of the "Obfuscript" criticims of Richard Stallman. I'm sure there are plenty of other valid references with other criticisms. -Pmffl (talk) 23:29, 17 March 2024 (UTC)

I looked into this more, and now I don't think it's a good idea to have this in the article. As stated at the end of the old thread linked above, "It is a big challenge, because it is a highly passionate subject among programmers." This Reddit thread is a good example; in particular, this sub-thread illustrates the point-and-counterpoint nature of these types of critiques and arguments. So I'm retracting this suggestion. -Pmffl (talk) 23:09, 18 March 2024 (UTC)