Talk:JavaScript/Variables and Types

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contrary to what this page says, JavaScript supports pretty much all of the OO features that it says it does not.

http://intertwingly.net/wiki/pie/JavaScript

function Foo() {
    this.test1 = function () { print("Hi from foo (1)"); }
    this.test2 = function () { print("Hi from foo (2)"); }
}
function Bar() {
    Foo.apply(this); // Bar inherits from Foo
    this.test1 = function () { print("Hi from bar") };
}
var foobar = new Bar();
foobar.test1();
foobar.test2();

66.101.11.218 13:22, 5 Feb 2005 (UTC)


I agree. A quick google for "classes in JavaScript" and "object-oriented Javascript"

shows quite a few pages about classes (and other OO features) in Javascript.

Definitely we'll want to talk about this in the JavaScript book. Should we stick information about implementing "classes" and "member methods" in Javascript at the end of the "JavaScript:Variables and types" chapter for now? --DavidCary 23:40, 15 December 2005 (UTC)


Perhaps this is a simplistic question, but what is the definition of a "type"? Webchoc (talk) 04:53, 19 November 2009 (UTC)