Syntax Error: invalid property id

Anonymous
2012-10-11
2013-05-28

  • Anonymous
    2012-10-11

    The following function gives the error "Syntax Error: invalid property id" when pasted into the online version of JavaScript Lint. As far as I know, any string is a valid property in a JavaScript object. BTW, I did try quoting the string 'id' and it didn't make any difference. I'm using Firefox 15.0.1 in case that's relevant. In the full JavaScript file I was trying to debug, when this error came up, a later, true syntax error was not found:
    <BBCode>
    function populateStudents($listelem, lStudents) {

    // -- Clear everything but the list divider
    $listelem.html("<li data-role='list-divider'>Students:</li>");

    // -- Fill in the list of students
    for (var i=0; i<lStudents.length; ++i) {
    var hStu = lStudents_;
    var stuID = hStu.ID;
    var ident = hStu.StudentIdent;
    var nLogs = hStu.lServiceLogs ? hStu.lServiceLogs.length : 0;
    // console.log(ident + ", " + nLogs + " logs");

    var $li = element('li',
    ,
    ,
    [ 'span',  { class: 'ui-li-count', id: 'count'+stuID },
      nLogs ? String(nLogs) : '0' ]
    );

    $listelem.append($li);
    }
    } /* populateStudents */
    </BBCode>_