Reinstall semicolons again!
return { init : function a(s) { init(s); } };
should be
return { init : function a(s) { init(s); } };
This is the result of a “function” in JavaScript that looks at your string using return
on it and says, “Oh, you forgot your semicolon, I'll add it for you.”
It changes return
to return;
, so your function now returns undefined, and then you have bare JSON sitting over it, which is the source of your error. Douglas Crockford actually describes this as one of the “terrible parts” of JavaScript.
So, the moral of this story is: always put your open shape on the same line when you code in JavaScript.
source share