Search Results

Search found 1 results on 1 pages for 'btoverdrive'.

Page 1/1 | 1 

  • Trouble defining method for Javascript class definition.

    - by btoverdrive
    I'm somewhat new to object oriented programming in Javascript and I'm trying to build a handler object and library for a list of items I get back from an API call. Ideally, I'd like the library functions to be members of the handler class. I'm having trouble getting my class method to work however. I defined as part of the class bcObject the method getModifiedDateTime, but when I try to echo the result of the objects call to this method, I get this error: Error on line 44 position 26: Expected ';' this.getModifiedDateTime: function(epochtime) { which leads me to believe that I simply have a syntax issue with my method definition but I can't figure out where. response( { "items": [ {"id":711,"name":"Shuttle","lastModifiedDate":"1268426336727"}, {"id":754,"name":"Formula1","lastModifiedDate":"1270121717721"} ], "extraListItemsAttr1":"blah", "extraListItemsAttr2":"blah2" }); function response(MyObject) { bcObject = new bcObject(MyObject); thing = bcObject.getModifiedDateTime(bcObject.videoItem[0].lastModifiedDate); SOSE.Echo(thing); } function bcObject(listObject) { // define class members this.responseList = {}; this.videoCount = 0; this.videoItem = []; this.responseListError = ""; // instantiate members this.responseList = listObject; this.videoCount = listObject.items.length; // populate videoItem array for (i=0;i<this.videoCount;i++) { this.videoItem[i] = listObject.items[i]; } this.getModifiedDateTime: function(epochtime) { var dateStringOutput = ""; var myDate = new Date(epochtime); dateStringOutput = myDate.toLocaleString(); return dateStringOutput; }; }

    Read the article

1