> Is the syntax for JavaScript the same for Java?
No, they are different languages. (Though some of the
code and method names can look similar).
(moments later..)
Actually, now that I check the definition of 'syntax',
I'll need to ease back from the first answer.
The syntax of Java and JavaScript has a lot of
similarities, but probably no more than the similarities
common to any two randonly chosen, high level,
OO languages.
Andrew T.
Gregc. - 03 Sep 2006 10:56 GMT
> No, they are different languages. (Though some of the
> code and method names can look similar).
[quoted text clipped - 7 lines]
> common to any two randonly chosen, high level,
> OO languages.
Thankyou.
> Hi
>
> Is the syntax for JavaScript the same for Java?
>
> Greg
There's this site called "Google"....
Searching for "java versus javascript" is probably a good idea.
Gregc. - 03 Sep 2006 10:54 GMT
> There's this site called "Google"....
> Searching for "java versus javascript" is probably a good idea.
Yes, I use a thing called "Google" regularly
> Is the syntax for JavaScript the same for Java?
No.
They have a lot of similarities, probably because they both
took the basic syntax from the C language (or from another
language that took it from C).
Java and JavaScript has less in common that Java and C++
(or Java and C#, or C# and C++, or ...), mainly because
JavaScript is not a class based language like the other.
For the basic flow control statements (if, for, while, do),
which have nothing to do with being class-based or not,
the languages are much closer. If you can read one, you can
probably read another.
/L

Signature
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
John W. Kennedy - 03 Sep 2006 21:19 GMT
>> Is the syntax for JavaScript the same for Java?
>
> No.
> They have a lot of similarities, probably because they both
> took the basic syntax from the C language (or from another
> language that took it from C).
There are some aspects of JavaScript that were taken from Java, such as
putting the standard mathematical functions into a name space called
Math (though in the case of Java, the name space is in the form of a
class, and in the case of JavaScript, it is in the form of an object).

Signature
John W. Kennedy
"The blind rulers of Logres
Nourished the land on a fallacy of rational virtue."
-- Charles Williams. "Taliessin through Logres: Prelude"
Hi
Greg
Most of the syntax for JavaScript is same as Java. There are many
differences
Like:-
In JavaScript we compare two strings for equality with ==
whereas,
In Java we compare two strings with equals() function.
:-)
Trilochan Singh.
> Is the syntax for JavaScript the same for Java?
They are different. One example of a difference: "class" is a reserved
word in Java, but not in JavaScript.
- Oliver
Oliver Wong - 27 Sep 2006 18:18 GMT
>> Is the syntax for JavaScript the same for Java?
>
> They are different. One example of a difference: "class" is a reserved
> word in Java, but not in JavaScript.
Moments after posting this, I find out that "class" is a "future
reserved word" in JavaScript, for the purpose of possible extensions. So
I'll rephrase the difference as:
"public class Foo {}" (without the quotes) is a legal Java compilation unit,
but not a legal JavaScript compilation unit.
- Oliver