Uncaught SyntaxError: Unexpected token )


#1

How do I eliminate this error, it is bugging me a lot. it is showing the unexpected token after the for loop i.e, “i++ )

function edit() {

var table = document.getElementById("table").innerHTML;

var Obj = JSON.parse(localStorage('myDb'));

for (i = 0, i < Obj.length, i++ ) {

    document.getElementById("fname").innerHTML = Obj[i].fname;
    document.getElementById("lname").innerHTML = Obj[i].lname;
    document.getElementById("age").innerHTML = Obj[i].age;
    document.getElementById("gender").innerHTML = Obj[i].gender;
    document.getElementById("mobile").innerHTML = Obj[i].mobile;
    document.getElementById("uname").innerHTML = Obj[i].uname;
    document.getElementById("pass1").innerHTML = Obj[i].pass1;
    document.getElementById("pass2").innerHTML = Obj[i].pass2;
    document.getElementById("email").innerHTML = Obj[i].email;

}
}

#2

The only error I can see is that you’re using commas in your for loop instead of semicolons to separate the values. Other than that, there’s no syntax issues in your code


#3

This topic was automatically closed after 7 days. New replies are no longer allowed.