[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

questions re Javascript

rdelaney2001

9/1/2015 10:35:00 PM

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
27 Answers

mentificium

9/1/2015 10:58:00 PM

0

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/sy...

is a tutorial AI mind in English.

http://www.nlg-wiki.org/syst...

is the same JavaScript AI in Russian.

http://ai.neocities.org/Ai...

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.

ram

9/1/2015 11:00:00 PM

0

rdelaney2001@gmail.com writes:
>I'm trying to get a handle in what Javascript is, isn't,
>what it does....

"JavaScript" is a trademark of Oracle Corporation. It is
used under license for technology invented and implemented
by Netscape Communications and current entities such as the
Mozilla Foundation. Oracle seems to tolerate some other
entities using the designation for their products too.

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

Commonly it is called a language. It includes routines
that can be accessed by calls of programs in the language.

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

Yes. It can also be used on a Web server (for example with
»node.js«). It is used to implement other languages
(via »asm.js«). It can be used as a general-purpose
programming language, but usually it needs some additional
library for this (a host object). But many other languages
also need additional libraries.

>What is its relation to Java, as a plug-in?

In fact, a JavaScript implementation, today, is part of
every Java installation. But this is a recent development.

Originally, it was intended to support Java applets as
a language for HTML authors that wanted to write glue that
connects Java applets with Web page. It was also designed
to have similarity with Java, but there are also many
differences between the two languages.

Java and JavaScript are both trademarks owned by Oracle.

> Are they
>independent?

Yes, they are independent of each other.

> Does Javascript execute/reside 'inside'
>Java, so to speak?

(see above.)

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

The language does normally not allow direct access of the
memory of the hardware computer (except by using attack
vectors / exploits).

JavaScript in Browsers possibly is the largest
security hole on consumer computers. By disabling it,
many vectors of attack will lose their foundation.

»If JavaScript is enabled in these applications,
then the system is vulnerable to exploitation.«

http://www.uscert.gov/current/current_activity...

(That content was retrieved some time ago and might be
different today.)

For some months only, I collected reports on browser
security holes that can be closed by disabling JavaScript.
If I had continued this until today, the list would be much
longer! (The reports are in German language.)

www.heise.de/newsticker/meldung/48769
www.heise.de/newsticker/meldung/48725
www.heise.de/newsticker/meldung/63430
www.heise.de/newsticker/meldung/48589
www.heise.de/newsticker/meldung/48016
www.heise.de/newsticker/meldung/48016
www.heise.de/newsticker/meldung/47993
www.heise.de/newsticker/meldung/60340
www.heise.de/newsticker/meldung/47998
www.heise.de/newsticker/meldung/47494
www.heise.de/newsticker/meldung/47282
www.heise.de/newsticker/meldung/46923
www.heise.de/newsticker/meldung/61499
www.heise.de/newsticker/meldung/60240
www.heise.de/newsticker/meldung/69558
www.heise.de/newsticker/meldung/66952
www.heise.de/newsticker/meldung/66943
www.heise.de/newsticker/meldung/66511
www.heise.de/newsticker/meldung/67698
www.heise.de/newsticker/meldung/67132
www.heise.de/newsticker/meldung/69894
www.heise.de/newsticker/meldung/68579
www.heise.de/newsticker/meldung/69225
www.heise.de/newsticker/meldung/66846
www.heise.de/newsticker/meldung/68391
www.heise.de/newsticker/meldung/69015
www.heise.de/newsticker/meldung/66480
www.heise.de/newsticker/meldung/66928
www.heise.de/newsticker/meldung/66350
www.heise.de/newsticker/meldung/64771
www.heise.de/newsticker/meldung/58788
www.heise.de/newsticker/meldung/61350
www.heise.de/newsticker/meldung/59374
www.heise.de/newsticker/meldung/60644
www.heise.de/newsticker/meldung/60855
www.heise.de/newsticker/meldung/64426
www.heise.de/newsticker/meldung/60615
www.heise.de/newsticker/meldung/68394
www.heise.de/newsticker/meldung/58228
www.heise.de/newsticker/meldung/61700
www.heise.de/newsticker/meldung/61646
www.heise.de/newsticker/meldung/61828
www.heise.de/newsticker/meldung/57578
www.heise.de/newsticker/meldung/56354
www.heise.de/newsticker/meldung/54973
www.heise.de/newsticker/meldung/59330
www.heise.de/newsticker/meldung/56795
www.heise.de/newsticker/meldung/56323
www.heise.de/newsticker/meldung/53382
www.heise.de/newsticker/meldung/59449
www.heise.de/newsticker/meldung/54272
www.heise.de/newsticker/meldung/56646
www.heise.de/newsticker/meldung/53186
www.heise.de/newsticker/meldung/53042
www.heise.de/newsticker/meldung/54063
www.heise.de/newsticker/meldung/52995
www.heise.de/newsticker/meldung/52935
www.heise.de/newsticker/meldung/55138
www.heise.de/newsticker/meldung/54716
www.heise.de/newsticker/meldung/52844
www.heise.de/newsticker/meldung/54431
www.heise.de/newsticker/meldung/54734
www.heise.de/newsticker/meldung/54487
www.heise.de/newsticker/meldung/54605
www.heise.de/newsticker/meldung/55396
www.heise.de/newsticker/meldung/53582
www.heise.de/newsticker/meldung/52776
www.heise.de/newsticker/meldung/52752
www.heise.de/newsticker/meldung/61245
www.heise.de/newsticker/meldung/52365
www.heise.de/newsticker/meldung/52377
www.heise.de/newsticker/meldung/54636
www.heise.de/newsticker/meldung/54719
www.heise.de/newsticker/meldung/54714
www.heise.de/newsticker/meldung/54697
www.heise.de/newsticker/meldung/52377
www.heise.de/newsticker/meldung/54582
www.heise.de/newsticker/meldung/52390
www.heise.de/newsticker/meldung/52255
www.heise.de/newsticker/meldung/54352
www.heise.de/newsticker/meldung/51995
www.heise.de/newsticker/meldung/51751
www.heise.de/newsticker/meldung/53644
www.heise.de/newsticker/meldung/60908
www.heise.de/newsticker/meldung/51511
www.heise.de/newsticker/meldung/50968
www.heise.de/newsticker/meldung/50363
www.heise.de/newsticker/meldung/50128
www.heise.de/newsticker/meldung/50111
www.heise.de/newsticker/meldung/50179
www.heise.de/newsticker/meldung/53489
www.heise.de/newsticker/meldung/52018
www.heise.de/newsticker/meldung/54188
www.heise.de/newsticker/meldung/49517
www.heise.de/newsticker/meldung/53499
www.heise.de/newsticker/meldung/49219
www.heise.de/newsticker/meldung/49219
www.heise.de/newsticker/meldung/49240
www.heise.de/newsticker/meldung/49240
www.heise.de/newsticker/meldung/49240
www.heise.de/newsticker/meldung/48877
www.heise.de/newsticker/meldung/48793
www.heise.de/newsticker/meldung/48892
www.heise.de/newsticker/meldung/53964
www.heise.de/newsticker/meldung/53519
www.heise.de/newsticker/meldung/53544

ram

9/1/2015 11:28:00 PM

0

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>Originally, it was intended to support Java applets as

Or, possibly, that was later. The inventor of JavaScript,
Brendan Eich said:

»The idea was to make something that Web designers,
people who may or may not have much programming training,
could use to add a little bit of animation or a little
bit of smarts to their Web forms and their Web pages.«

Then, there was a system that was called »Live Connect«
that allowed Java applets and JavaScript to interact.
But I heard that this might not be supported anymore.

Tim Streater

9/2/2015 7:29:00 AM

0

In article <2b531f48-fff9-4c73-a116-22a3f110e919@googlegroups.com>,
<rdelaney2001@gmail.com> wrote:

>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?

Broadly speaking its a language that you can use to write scripts to
manipulate the web page inside your browser.

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

Eh? That sounds more like something you'd use CSS for.

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

Javascript has nothing to do with Java except for having a similar
sounding name.

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

Nothing to do with hardware, the language is interpreted by your
browser. For the most part, you might be using it to
create/remove/modify elements (such as tables, paragraphs, etc) that
make up the web page being displayed. What is displayed would then
change accordingly.

--
"Please stop telling us what you feel. Please stop telling us what your
intuition is. Your intuitive feelings are of no interest whatsoever,
and nor are mine. I don't give a bugger what you feel, or what I feel.
I want to know what the evidence shows." -- Richard Dawkins

ram

9/2/2015 11:13:00 AM

0

Newsgroups: comp.lang.javascript,comp.lang.java

Tim Streater <timstreater@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. 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.

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/. The promise of its
name is thus fulfilled. And both come from the company that
also owns the trademark for both names.

The OP has multiposted this to both comp.lang.javascript
and comp.lang.java. Don't multipost, crosspost, OP!

Newsgroups: comp.lang.javascript,comp.lang.java

ram

9/2/2015 11:20:00 AM

0

Supersedes: <java-and-javascript-20150902120532@ram.dialup.fu-berlin.de>
[comp.lang.java -> comp.lang.java.programmer]

Newsgroups: comp.lang.javascript,comp.lang.java.programmer

Tim Streater <timstreater@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. 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.

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. The
promise of its name is thus fulfilled. And both come from
the same company that also owns the trademark for both names.

The OP has multiposted this to both comp.lang.javascript
and comp.lang.java.programmer. Don't multipost, crosspost, OP!

Newsgroups: comp.lang.javascript,comp.lang.java.programmer

Jay Braun

9/2/2015 9:43:00 PM

0

> 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

9/2/2015 10:43:00 PM

0

Stefan Ram wrote:

> Tim Streater <timstreater@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

ram

9/2/2015 11:03:00 PM

0

"Christoph M. Becker" <cmbecker69@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 */

>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

Early Java allowed closures even more powerful than today's
Java, although they were not called »closures« (and also are
not called »closures« today), but »inner classes«. They were
then partially removed, reportedly due to an »outcry«.

»Guy Steele wrote:

Actually, the prototype implementation *did* allow
non-final variables to be referenced from within
inner classes. There was an outcry from *users*,
complaining that they did not want this!«

http://madbean.com/2003/...

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«).
The Prototyp of Java, according to Guy Steele, had closures,
but not lambdas. Todays Java has lambdas, but not closures
(not /full/ closures, only a restricted form of closures).

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

Christoph M. Becker

9/2/2015 11:46:00 PM

0

Stefan Ram wrote:

> "Christoph M. Becker" <cmbecker69@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