Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Test = new function() {
- this.init = new function() {
- alert("hello");
- }
- this.run = new function() {
- // call init here
- }
- }
- var Test = new function() {
- this.init = function() {
- alert("hello");
- };
- this.run = function() {
- // call init here
- this.init();
- };
- }
- Test.init();
- Test.run();
- // etc etc
- function test() {
- var self = this;
- this.run = function() {
- console.log(self.message);
- console.log("Don't worry about init()... just do stuff");
- };
- // Initialize the object here
- (function(){
- self.message = "Yay, initialized!"
- }());
- }
- var t = new test();
- // Already initialized object, ready for your use.
- t.run()
- var Test = function() {
- this.init = function() {
- alert("hello");
- }
- this.run = function() {
- // call init here
- this.init();
- }
- }
- //creating a new instance of Test
- var jj= new Test();
- jj.run(); //will give an alert in your screen
- var Test = function() {
- this.init = function() {
- alert("hello");
- }
- this.run = function() {
- this.init();
- }
- }
Add Comment
Please, Sign In to add comment