JavaScript: Difference between revisions

Content deleted Content added
Func (talk | contribs)
reverting to 27 July, someone's test, and an odd "Now then..."
Line 48:
For convenience, Types are normally subdivided into ''primitives'' and ''objects''. Objects are entities that have an identity (they are only equal to themselves) and that map property names to values, ("slots" in [[prototype-based programming]] terminology). That is, an object is an [[associative array]] similar to hashes in the [[Perl programming language]], arrays in [[PHP]], or dictionaries in [[Python programming language|Python]], [[PostScript]] and [[Smalltalk programming language|Smalltalk]].
 
JavaScript has several kinds of built in objectsobjectss, namely [[Array]], [[Boolean datatype|Boolean]], [[Date]], [[Function (programming)|Function]], [[Mathematics|Math]], [[Number]], [[Object (computer science)|Object]], [[regular expressions|RegExp]] and [[String#Mathematics and Computer Science|String]]. Other objects are "host objects", defined not by the language but by the runtime environment. For example, in a browser, typical host objects belong to the [[Document Object Model|DOM]] ([[window (computing)|window]], [[form (document)|form]], [[link]]s etc.).
 
By defining a [[constructor function]] it is possible to define objects. JavaScript is a [[prototype-based programming|prototype based]] object-based language. This means that inheritance is between objects, not between classes (JavaScript has no classes). Objects inherit properties from their prototypes.