Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

questions re Javascript

46 views
Skip to first unread message

rdelan...@gmail.com

unread,
Sep 1, 2015, 6:35:05 PM9/1/15
to
I'm trying to get a handle in what Javascript is, isn't,
what it does....

Is it a language, or a set of library routines? If
the latter, how are they accessed?

Is it used, or useful, for anything besides hovering
the cursor over an image on a Web page?

What is its relation to Java, as a plug-in? Are they
independent? Does Javascript execute/reside 'inside'
Java, so to speak?

What are the limitations of the language, in terms of
hardware, memory access, security, etc.?


Thx,

--
Rich

menti...@gmail.com

unread,
Sep 1, 2015, 6:58:26 PM9/1/15
to
On Tuesday, September 1, 2015 at 3:35:05 PM UTC-7, rdelan...@gmail.com wrote:
> I'm trying to get a handle in what Javascript is, isn't,
> what it does....[...]
>
> Is it used, or useful, for anything besides hovering
> the cursor over an image on a Web page? [...]

JavaScript serves Strong AI research:

http://www.nlg-wiki.org/systems/Mind

is a tutorial AI mind in English.

http://www.nlg-wiki.org/systems/Dushka

is the same JavaScript AI in Russian.

http://ai.neocities.org/AiSteps.html

provides more details on Strong AI.

Cheers,

Arthur T. Murray/Mentifex
--
Major goal in life: Trigger a Technological Singularity;
Minor goal: Overthrow the unelected government of China;
Minor goal: Win a Nobel Prize in Physiology or Medicine;
Minor goal: [X] Reunification of East and West Germany.

Jay Braun

unread,
Sep 2, 2015, 5:43:08 PM9/2/15
to
> Is it a language, or a set of library routines? If
> the latter, how are they accessed?

It is a language designed to run in a web browser. It adds dynamic behaviors that static HTML pages cannot perform.

> Is it used, or useful, for anything besides hovering
> the cursor over an image on a Web page?

A little Googling will convince you that is is.

> What is its relation to Java, as a plug-in? Are they
> independent? Does Javascript execute/reside 'inside'
> Java, so to speak?

JavaScript was originally called Mocha, then LiveScript by its inventors at NetScape. The name JavaScript was intended to take advantage of Java's growing popularity in the mid-to-late 1990s.

While the two share some syntactic heritage from C, they are independent languages designed for distinct purposes. Java programs execute in the JRE/JVM, while JavaScript generally runs in a browser. There are some "server-side" platforms for running JavaScript, such as Node.js, as well as a version of JavaScript that runs in the JRE, called Rhino. But JavaScript is *not* a subset of variant of Java.

There is also something called BeanShell, which is essentially scripted Java that can run inside the JRE, even as part od a Java application, but it has nothing to do with JavaScript. (I mention it because the name JavaScript would have been an ideal name for BeanShell, but it was already taken.)

> What are the limitations of the language, in terms of
> hardware, memory access, security, etc.?

Think of it as a programming language whose platform is the browser. So, while it is expressive and powerful, you cannot access your operating system's file system, TCP ports, and other resources outside the browser.

Christoph M. Becker

unread,
Sep 2, 2015, 6:43:13 PM9/2/15
to
Stefan Ram wrote:

> Tim Streater <timst...@greenbee.net> writes:
>> Javascript has nothing to do with Java except for having a similar
>> sounding name.
>
> There are so many similiarities between the two languages,
> that I can't name them all. For example, in both Java and
> JavaScript,
>
> 2 + "x"
>
> gives »"2x"«,

Does that really work in Java? Most certainly the following won't:

int x = 2;
String y = "x";

x + y;

> while in many other languages it does not.
> In both Java and JavaScript, the modulo operator »%« can be
> used for doubles,

Well, JavaScript has only "doubles" (actually, Numbers), but no integers
(I'm deliberately ignoring asm.js), so there's no point in defining an
modulo operator that wouldn't work with "doubles".

> while in many other languages, it cannot.
> Both have »instanceof« with a similar meaning, while other
> languages do not.

Counter-examples: C#, PHP.

> In both languages »x == x« is false, when
> x is NaN.

What is enforced by IEEE 754.

> And there are so many more similarities. And this
> is no surprise, as Brendan Eich, the creator of JavaScript,
> tells us:
>
> »The diktat from upper engineering management was that
> the language must "look like Java".«
>
> I have read this sentence »Javascript has nothing to do with
> Java except for having a similar sounding name« so often.
> One copies it from the other. But not one stops to think!
> Or to read. If one knows just a little bit about Java and
> JavaScript, it is obvious that they have so much in common.

Of course, JavaScript and Java have much in common. Mostly, that
JavaScript's syntax was designed to resembles Java's, even though early
versions of JavaScript and Java were *very* different. Early versions
of Java didn't even have closures (a basic building block of all but the
most trivial JavaScript scripts), and JavaScript doesn't have classes
until recently (and AFAIK these "classes" are still only a thin wrapper
over the more versatile prototypal inheritance).

Comparing JavaScript with Java is like comparing apples with oranges
(yes, both have a lot of similarities…). I consider somewhat recent
versions of PHP to be more similar to Java than JavaScript is, for instance.

--
Christoph M. Becker

Christoph M. Becker

unread,
Sep 2, 2015, 7:45:52 PM9/2/15
to
Stefan Ram wrote:

> "Christoph M. Becker" <cmbec...@arcor.de> writes:
>> Does that really work in Java? Most certainly the following won't:
>> int x = 2;
>> String y = "x";
>> x + y;
>
> Not exactly in this wording, but essentially:
>
> public final class Main
> { public static void main( final java.lang.String[] args )
> { final int x = 2;
> final java.lang.String y = "x";
> java.lang.System.out.println( x + y ); }} /* prints:
> 2x */

Interesting, thanks! Nonetheless this seems to be rather a particular
convenience regarding "constants", and not a general flexibility of the
type system.

>> versions of JavaScript and Java were *very* different. Early versions
>> of Java didn't even have closures (a basic building block of all but the
>
> One must not confuse the syntactic feature of function literals
> (called »lambdas«) with the semantic feature of entities that
> »close over« (contain) local environments (called »closures«).

Thanks for the clarification.

> (Possibly, the first versions of LISP had lambdas, but not
> closures, too, then closures were invented to solve the
> »outward funarg problem« IIRC.)

IIRC, early versions of LISP where dynamically scoped (a concept I still
can't really grasp, and what unfortunately is reflected by `this` in
ECMAScript), whereas only later versions (most notably Common Lisp and
Scheme) defaulted to lexical scoping (which is much more intuitive to me).

Anyhow, I still think that Java has its main roots in C++, and
JavaScript in Scheme, and as such I'd categorize Java as
object-oriented, but JavaScript as functional (actually, applicative)
programming language (the lines are blurred, and are becomming more
blurred as time goes by, though).

PS: I'm aware of Guy L. Steele's influence on Scheme, Common Lisp *and*
Java.

--
Christoph M. Becker

Arne Vajhøj

unread,
Sep 3, 2015, 7:57:25 PM9/3/15
to
On 9/2/2015 6:43 PM, Christoph M. Becker wrote:
> Stefan Ram wrote:
>> Both have »instanceof« with a similar meaning, while other
>> languages do not.
>
> Counter-examples: C#, PHP.

It is not called instanceof in C#.

Arne

Arne Vajhøj

unread,
Sep 3, 2015, 8:01:23 PM9/3/15
to
On 9/2/2015 7:20 AM, Stefan Ram wrote:
> Tim Streater <timst...@greenbee.net> writes:
>> Javascript has nothing to do with Java except for having a similar
>> sounding name.
>
> There are so many similiarities between the two languages,
> that I can't name them all. For example, in both Java and
> JavaScript,
>
> 2 + "x"
>
> gives »"2x"«, while in many other languages it does not.
> In both Java and JavaScript, the modulo operator »%« can be
> used for doubles, while in many other languages, it cannot.
> Both have »instanceof« with a similar meaning, while other
> languages do not. In both languages »x == x« is false, when
> x is NaN.

If these are the criteria then a lot of languages are like Java.

> And today, JavaScript is part of Java (the JRE), so it is
> actually wrapped together with Java, and today JavaScript
> can finally be used /to script Java/ out of the box.

I don't think that Java being able to execute JavaScript
tell much about whether the two languages are close.

I can not see any reason why you could not embed a JavaScript
engine in COBOL runtime.

> The
> promise of its name is thus fulfilled. And both come from
> the same company that also owns the trademark for both names.

No.

SUN created Java.

NetScape created JavaScript.

NetSCape got permission from SUN to use the Java prefix.

Arne

Christoph M. Becker

unread,
Sep 3, 2015, 8:37:35 PM9/3/15
to
Oops – I've googled not thoroughly enough. Thanks for the correction.

--
Christoph M. Becker

Martin Gregorie

unread,
Sep 4, 2015, 4:48:29 AM9/4/15
to
On Thu, 03 Sep 2015 20:01:16 -0400, Arne Vajhøj wrote:

> I can not see any reason why you could not embed a JavaScript engine in
> COBOL runtime.
>
...or run both a COBOL compiler and the generated code in the JRE.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

Joshua Cranmer 🐧

unread,
Sep 4, 2015, 11:09:26 AM9/4/15
to
On 9/2/2015 6:20 AM, Stefan Ram wrote:
> There are so many similiarities between the two languages,
> that I can't name them all.

Really? I can:

* Java and JS share the same core C-ish syntax (but not necessarily
semantics) for expressions and statements.
* They both use a strictly-defined evaluation order instead of C's
undefined evaluation order.
* A few method names (e.g., toString, or Math.sin) are the same.
* The JS Date object is explicitly modelled on Java's Date object
(unfortunately).
* Their names start with the same first four letters.

That's really about it. Java and JS use hugely different internal
representations, and the semantics are often vastly different. Most
notably, JS has no integers, only IEEE754 doubles, and the == operator
in Java corresponds to === in JS where == in JS is .equals() in Java.

For my part, calling the languages similar when semantics are so
different does a disservice to neophytes attempting to learn one or the
other. It's like saying English and French are similar, because they
share the same grammatical constructs and many words are cognates.
Peut-être il est vrai, mais on ne peut pas converser avec un autre sans
apprendre à parler l'autre langue.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Evertjan.

unread,
Sep 4, 2015, 12:17:36 PM9/4/15
to
r...@zedat.fu-berlin.de (Stefan Ram) wrote on 04 Sep 2015 in
comp.lang.javascript:

> What I objected to was the typical wording
>
> ŻJavaScript /has nothing to do/ with Java.Ž.

It has NOTHING TO DO with it.

That MEANS:
that the word "Java" in "Javascript" does not mean
it is the scripting [=interpreting] form
of the compiler-language "Java", and cannot be compared with
Vbscript as the scripting form of Visual Basic,
ot other script forms of compiler lenguages,
or perhaps other compiler forms of scripting languages.

It does NOT mean that:
both are not computer-languages,
both are not a subset of English words,
both have never influenced each other,
both are nowhere influenced by any common earlier language,
are both used by human beings,
some of them being smarter than others.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Arne Vajhøj

unread,
Sep 4, 2015, 7:40:48 PM9/4/15
to
On 9/4/2015 11:33 AM, Stefan Ram wrote:
> =?UTF-8?Q?Joshua_Cranmer_=f0=9f=90=a7?= <Pidg...@verizon.invalid> writes:
>> other. It's like saying English and French are similar, because they
>> share the same grammatical constructs and many words are cognates.
>
> What I objected to was the typical wording
>
> »JavaScript /has nothing to do/ with Java.«.
>
> To me, it would be disputable too when one would say,
>
> »English has nothing to do with French.«.

I think the term "has nothing to do with" should be seen in context.

If it is a thread about the evolution of languages and how they
relate, then it is not a good statement.

If it is a thread with a specific question about
syntax/semantics/library, then I think it is a pretty good
statement.

Any attempt to answer a Java question based on JavaScript
or a JavaScript question based on Java is very bad, because
the risk of the answer being wrong is huge.

And it is actually the same about English and French.

If one is discussing history then certainly French
influenced English after 1066 and in modern times
English has probably influenced French a little bit as
well (even though they try hard to create French
equivalent words).

But if it is a question about grammar rules and
pronunciation, then it would most likely result in
incorrect answers to try and answer question for
one based on the other.

Arne



Thomas 'PointedEars' Lahn

unread,
Sep 5, 2015, 3:39:06 AM9/5/15
to
[F'up2 comp.lang.javascript]

Arne Vajhøj wrote in <news:comp.lang.javascript> and
<news:comp.lang.java.programmer>:
_Sun_

> NetScape created JavaScript.
>
> NetSCape got permission from SUN to use the Java prefix.

_Netscape_

Speakers of German (and hopefully, in the future, speakers of English as
well, as efforts at translation into English are underway) may want to read
my 2012 thesis on the subject, and follow the references therein, to clarify
some of their misconceptions. It is referred to from the ECMAScript
[Support] Matrix (see signature), which since then serves as the proof of
concept of the thesis.

--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Thomas 'PointedEars' Lahn

unread,
Sep 5, 2015, 3:50:43 AM9/5/15
to
[F'up2 comp.lang.javascript]

Arne Vajhøj wrote:

> On 9/4/2015 11:33 AM, Stefan Ram wrote:
>> What I objected to was the typical wording
>>
>> »JavaScript /has nothing to do/ with Java.«.
>>
>> To me, it would be disputable too when one would say,
>>
>> »English has nothing to do with French.«.
>
> I think the term "has nothing to do with" should be seen in context.
>
> If it is a thread about the evolution of languages and how they
> relate, then it is not a good statement.
>
> If it is a thread with a specific question about
> syntax/semantics/library, then I think it is a pretty good
> statement.

The statement should be modified to say “has *little* to do with Java” in
that context because JavaScript was intentionally designed to resemble Java
syntactically and semantically.

Please stop crossposting without Followup-To. A discussion belongs only
into to *one* newsgroup; in this case, comp.lang.javascript.

Chuck Anderson

unread,
Sep 5, 2015, 5:22:59 AM9/5/15
to
> I'm trying to get a handle in what Javascript is, isn't,
> what it does....

It makes web page content jump around so much that it's impossible to
follow as ads keep loading and the content you sought vanishes. But
hey, at least you can correct your penile dysfunction - look at cute
cats - or imagine that buxom lass really that wants you.

Yay JavaScript. :(

--
*****************************
Chuck Anderson • Boulder, CO
http://cycletourist.com
Turn Off, Tune Out, Drop In
*****************************

Luuk

unread,
Sep 5, 2015, 8:15:17 AM9/5/15
to Stefan Ram
On 02-09-15 13:13, Stefan Ram wrote:
> Newsgroups: comp.lang.javascript,comp.lang.java
>
> Tim Streater <timst...@greenbee.net> writes:
>> Javascript has nothing to do with Java except for having a similar
>> sounding name.
>
> There are so many similiarities between the two languages,
> that I can't name them all. For example, in both Java and
> JavaScript,
>


They (Java & Javascript) might be similar, but they have noting to do
with each other.

Javascript is a language based on a standard
(https://en.wikipedia.org/wiki/ECMAScript)

Java is owned by Oracle (so, not based on an independant standard,
besides the standard that Oracle creates for it.....)


Eternal Hope

unread,
Sep 5, 2015, 3:29:12 PM9/5/15
to
On 04/09/2015 22:51, Tim Streater wrote:
> In article
> <Java-and-JavaScri...@ram.dialup.fu-berlin.de>, Stefan
> Ram <r...@zedat.fu-berlin.de> wrote:
>
>> Tim Streater <timst...@greenbee.net> writes:
>>> Given that the OP didn't seem to know very much, at this point in his
>>> learning process it is *much* *better* to say that these languages are
>>> not related. Then he can get on. He can learn a more nuanced lesson
>>> later on. All you and similar posters are likely to do at this stage,
>>> with your pedantry, is to confuse him.
>>
>> You might underestimate the intelligence of a beginner
>> when you believe that the correct answer
>>
>> »JavaScript and Java are different languages.«
>>
>> will significantly confuse him.
>
> You didn't say they were different languages. If you had, all would
> have been well. Instead you went off into a pedantic labyrinth where
> the learner doesn't need to go.
>
> It has nothing to do with the learner's intelligence and everything to
> do with interpreting his question and giving a useful answer.

Sanity.

Alive and well in c.l.j.p.

Good to see



--
Laughing Spam Fritter

Thomas 'PointedEars' Lahn

unread,
Sep 5, 2015, 4:20:00 PM9/5/15
to
[F'up2 comp.lang.javascript]

Thomas 'PointedEars' Lahn wrote:

> Arne Vajhøj wrote:
>> On 9/4/2015 11:33 AM, Stefan Ram wrote:
>>> What I objected to was the typical wording
>>>
>>> »JavaScript /has nothing to do/ with Java.«.
>>>
>>> To me, it would be disputable too when one would say,
>>>
>>> »English has nothing to do with French.«.
>>
>> I think the term "has nothing to do with" should be seen in context.
>>
>> If it is a thread about the evolution of languages and how they
>> relate, then it is not a good statement.
>>
>> If it is a thread with a specific question about
>> syntax/semantics/library, then I think it is a pretty good
>> statement.
>
> The statement should be modified to say “has *little* to do with Java” in
> that context because JavaScript was intentionally designed to resemble
> Java syntactically and semantically.

And, I should add, probably as a result of the Sun/Netscape agreement,
starting from version 1.2 (in Netscape 4.0), (Netscape) JavaScript was
modified to access Java applets (a feature called LiveConnect, actually a
part of the Netscape AOM, which was removed from the core language
definition with version 1.4 (server-side only) and eventually became
XPConnect, an official part of the Mozilla AOM, with Mozilla JavaScript
1.5/Mozilla 1.0; the origin of the Netscape Plugin API [NPAPI] for which
support is gradually being removed from browsers now), and Java was modified
so that you could access JavaScript code from applets embedded in an HTML
document (still called LiveConnect).

<https://en.wikipedia.org/wiki/NPAPI> p.
0 new messages