I am trying to create a constructer function as follows in javascript. But i get the error:
SyntaxError: Unexpected token ILLEGAL
I am getting this when i run the following in chrome developer tools console:
function People () {
this.superstar = "Michael Jackson";
}
Is there any syntax error in the same. If not then whats causing the error.
You probably have a weird invisible character there, but rewriting it works fine:
function People(){
this.superstar = "Michael Jackson";
}