Hello to all, my first post to this group! I am new to OOP in JavaScript and have written my first Js Class using prototype.js.. On the 'Learn pages' at prototypejs.org the example for 'Classes-Inheritance' shows the following..
var Logger = Class.create({ initialize: function() { // this is the right way to do it: this.log = []; }, write: function(message) { this.log.push(message); } }); For some reason I can't seem to add to the array using 'this.arrayName'. I have tried also this.arrayName[i] = value; I initialize the array using the method shown above I have had to use the following in my method that updates the array. I have several methods that will update arrays, and will probably have to use the same in those. It will mean two lines of extra code for each method!! . var qArr = this.cap_questions; // create a var as the array // for(blah blah){ var q = // set-up the value // qArr.push(q); } this.cap_questions = qArr; // restore the classes array value with updated var // Does anyone have an explanation for this, or is it a bug?? If its a bug, should it be reported at the site?? Thanks in advance.. Gilbert --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---