Talk:JavaScript/Archive 6

Page contents not supported in other languages.
Source: 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

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. -
@
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. -
@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.

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)


Language families

Programming languages are like natural languages, so can we put a box to the side of the page like on a natural language page, that has the languages pedigree? for example,


Spanish
Castilian
  • español
  • castellano
Pronunciation[espaˈɲol]
[kasteˈʝano] , [kasteˈʎano]
SpeakersNative: 500 million (2023)[1]
Total: 600 million[1]
100 million speakers with limited capacity (23 million students)[1]
Indo-European
Early forms
Spanish alphabet)
Spanish Braille
Signed Spanish (using signs of the local language)
Official status
Official language in

Dependent territories

Partially recognized country

Significant minority

Real Academia Española and 22 other national Spanish language academies)
Language codes
ISO 639-1es
ISO 639-2spa
ISO 639-3spa
Glottologstan1288
Linguasphere51-AAA-b
  Co-official or administrative language but not majority native language
  Secondary language (more than 20% Spanish speakers) or culturally important
This article contains IPA phonetic symbols. Without proper rendering support, you may see question marks, boxes, or other symbols instead of Unicode characters. For an introductory guide on IPA symbols, see Help:IPA.

38.43.22.44 (talk) 21:26, 3 April 2024 (UTC)

As you can see, Spanish is descended from Latin, which is descended from Proto Indo European. Could we show the same with Javascript, to show that it is descended from C++, which in turn is descended from SIMULA? 38.43.22.44 (talk) 21:33, 3 April 2024 (UTC)
Note: the sources cited are accidental. 38.43.22.44 (talk) 21:35, 3 April 2024 (UTC)
Programming languages are like natural languages. No they aren't. That being said, like many collections of things (family trees, biological taxonomies, books in a library) they can be arranged in a hierarchy. At least, some of them can. I'm supposing some of them would be better described as creoles. I'll leave it to others to discuss whether this is of value. But perhaps this would be better discussed at a higher-level, general page like Wikipedia:WikiProject Software. Largoplazo (talk) 00:58, 4 April 2024 (UTC)
Programming languages are like natural languages, so can we put a box to the side of the page like on a natural language page, that has the languages pedigree? Yes, you can; it's called {{Infobox programming language}}, and it's already there.
As you can see, Spanish is descended from Latin, And, as you can see from that infobox, JavaScript is descended from Java,[4][5] Scheme,[5] Self,[6] AWK,[7] and HyperTalk[8]
which is descended from Proto Indo European. Which is only implicitly mentioned in the {{Infobox language}} infobox in Spanish language.
That infobox gives a taxonomy, not a history; the taxonomy has Indo-European at the top, meaning that it's the topmost category in which Spanish belongs; all languages in that category descend from the Proto-Indo-European language. The "Latin" in the Language family section of that infobox refers to a "Latin" subfamily of the Latino-Faliscan languages. That subfamily can either be thought of as being the Romance languages, if you include the Latin language as a Romance language, or Latin plus the Romance languages, if you consider the Romance languages to be the descendants of Latin.
Whilst JavaScript inherits some syntax and ideas from some other languages, it also has ideas of its own, so it's not clear from its influences to which hierarchy of families it belongs (more than just Java, and it doesn't inherit everything from Java) So the infobox has, instead, there are various language types, or programming paradigms - a language may use more than one paradigm - predecessors ("influenced by"), and successors ("influenced")
Could we show the same with Javascript, to show that it is descended from C++ Is it descended directly from C++, or it it descended from - or, rather, influenced by -
JavaScript is a Lisp-like language with Java-like syntax. C++ has nothing to do with it except that it was one of the first popular object-oriented programming languages. Which goes to show that this is a bad idea: including this won't teach anybody anything and will invite endless bickering. Rp (talk) 08:57, 4 April 2024 (UTC)
Then what is this? https://commons.wikimedia.org/wiki/File:Genealogical_tree_of_programming_languages.svg 38.43.22.44 (talk) 17:56, 4 April 2024 (UTC)
It's a directed acyclic graph of influences of languages on other languages that appears to omit the influence of C on C++ and the influence of Smalltalk on Objective-C, so perhaps it should be titled "Incomplete graph of influences of programming languages on other programming languages".
It also shows
ok 38.43.22.44 (talk) 22:20, 4 April 2024 (UTC)
Guys, I don't want to dispute, please, I just would like something like the thing over here→→→→→→→→→→→→→→→→→→→→→
I think it could be useful. 38.43.22.44 (talk) 17:59, 4 April 2024 (UTC)
I don't want to dispute But you submitted a proposal; did you seriously think that submitting a proposal does not risk dispute? If so, you made a mistaken assumption. (Even if you thought your particular proposal was uncontroversial, you made a mistaken assumption, as you have now discovered.)
I think it could be useful And I am unconvinced of that, for the reasons I've already given. It appears that
Yeah that is what I mean. Arrange a taxonomy of programming languages, with Javascript at the bottom and its oldest ancestor at the top. And its descendants too, like Ruby. 38.43.22.44 (talk) 17:54, 4 April 2024 (UTC)
That's not what a
Norman conquest nor the major grammatical changes resulting from the influence of, it appears, Old Norse (Middle English § Transition from Old English
), which would show up in a directed acyclic graph of major influences of human languages on other human languages.
If you want to show the languages that influenced JavaScript and the languages it influenced, all you have to do is Not. Remove. From. The. Article. The. Infobox. That's. Already. There.
ok 38.43.22.44 (talk) 22:18, 4 April 2024 (UTC)

Disagree with this proposal. The notion of a family is inherently flawed when it comes to JavaScript. It is a distinct language created (rather hastily in hindsight) for the specific purpose of dynamic webpages. The current "Influenced" lists in the sidebar are sufficient as-is. -Pmffl (talk) 14:05, 5 April 2024 (UTC)

ok. 38.43.22.44 (talk) 15:22, 5 April 2024 (UTC)
Despite my blunt statement, I appreciate this thread. It was an interesting reminder of just how different natural languages are from our very recent (in terms of millennia of human history) computer revolution with lots of different programming languages. So please don't feel too bad about the outcome of this thread. -Pmffl (talk) 16:16, 6 April 2024 (UTC)
ok 38.43.22.44 (talk) 23:08, 6 April 2024 (UTC)

References

  1. ^ a b c Cite error: The named reference viva18 was invoked but never defined (see the help page).
  2. ^ Eberhard, Simons & Fennig (2020)
  3. ^ Hammarström, Harald; Forkel, Robert; Haspelmath, Martin; Bank, Sebastian, eds. (2022). "Castilic". Glottolog 4.6. Jena, Germany: Max Planck Institute for Evolutionary Anthropology. Archived from the original on 28 May 2022. Retrieved 19 June 2022.
  4. from the original on 24 December 2020. Retrieved 25 December 2018. Eich: The immediate concern at Netscape was it must look like Java.
  5. ^ a b Cite error: The named reference origin was invoked but never defined (see the help page).
  6. ^ "Popularity – Brendan Eich".
  7. ^ "Brendan Eich: An Introduction to JavaScript, JSConf 2010". YouTube. p. 22m. Archived from the original on 29 August 2020. Retrieved 25 November 2019. Eich: "function", eight letters, I was influenced by AWK.
  8. .