Every time I attempt to run this code, a syntax error (unexpected token) appears. As someone who is still learning JavaScript, I am struggling to identify the root cause of this issue.
var x = 1;
var example = function(){
for(var y = 0; y < 10; y++){
x++;
console.log(x);
};
do{
x = 2;
console.log(x);
while(x===2){
x--;
console.log(x);
};
};
};
function example();