defining a class in Jscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Jscript */ | |
/* Class in JavaScript */ | |
var ClassName = (function () { | |
// Constructor | |
function ClassName(message) { | |
this.variable1 = message; | |
} | |
// Method | |
ClassName.prototype.greet = function () { | |
return "Hello, " + this.variable1; | |
}; | |
return ClassName; | |
})(); | |
var greeter = new ClassName("world"); |