22 - error - unexpected identifier


#1

I always get SyntaxError: Unexpected identifier, and I can't get why!

dynamicallyfunction Person(first,last,age) {
   this.firstName = first;
   this.lastName = last;
   this.age = age;
}

var john = new Person('John','Smith',30);
var myFirst = john.firstName;
var myLast = john.lastName;
var myAge = john.age;

what do you think?
thank you


#2

first line
rewrite it if you so have to (the first line)
if you repeat the mistake then look up syntax for a function (google: "mdn function") and compare to your code.


#3

LOL it was enough to remove the "dynamically" - I didn't even notice it while copying and paste :open_mouth:


#4

And we need to be able to systematically find such mistakes because there's no way we will ever stop making them.

The error messages in the js environment here are terrible though, at least it could give up line numbers. I suggest using a different interpreter for finding stuff like this, one with more verbose error messages. Your browser or some online interpreter or node.js if you happen to have that installed