Simon Egginton wrote:
OH that's another thing you pedantic old fart Java and
Java script is virtually the same. I don't know why in hells
name you keep on saying there not? what's the difference?
Tell me that ehh?
<snip>
Java and javascript are a very long way form being the same. Beyond the
fact that they both use a syntax reminiscent of C they are not even that
similar. Off the top of my head, some differences include:-
Java | Javascript
-----------------------------------------------------------------------
Strongly type language with an | Loosely typed language with
infinitely extendable number of | exactly 6 distinct types (7 if you
type definitions. | want to consider Function objects
| separately form Object objects).
|
Type casting/converting is | All types may be converted to all
restricted to what makes sense (in | other types without restriction
terms of inheritance | (but with potential data loss),
relationships, the implementation | and automatic type-conversion
of interfaces and (with | follows form the context of
primitives) the nature of the date | use/reference.
they represent and how it would be |
changed by the modification.) |
|
Pre-compiled to, and distributed | Distributed as source text and
as, byte code. | re-interpreted prior to each
| execution.
|
Exclusively Object Orientated | Scripts may be Object Orientated,
language. | procedural or functional (or any
| combination).
|
Class-based language in which | Dynamic language in which all
class definitions are fixed at the | definitions and structures are
point of compilation. | amenable to unlimited run-time
| modification (precluding any
| directly analogous "class"
| concept).
|
Class-based inheritance. | Prototype-based inheritance.
|
No global variables. | Global variables are properties of
| the global object and all scripts
| share the global object with each
| other and the host environment.
|
Block scoped local variables. | Lexically scoped variables (at
| function intervals), with
| function nesting and closures.
|
Built in support for access | Unrestricted access to all object
modifiers (public, private, | properties (unless restrictions
protected, etc). | are actively implemented using
| closures).
|
Functions can only exist as | Functions are objects and may be
methods of an instance or a class. | passed by reference, assigned
| properties/methods, and may be
| executed as method of objects or
| not, depending on the context of
| their use.
|
Methods take strictly defined | Functions take any arguments list
numbers and types of argument. | used when they are called.
|
Many packages included in the | All facilities beyond the basic
language for things like GUI | language are expected to be
construction, networking and file | provided by the host environment
handling. | (or are unavailable).
Richard.