Repeat after me: Javascript is not Python
I guess I'm too used to the Python programming language that whenever I have to write simple Javascript functions I keep making the same mistakes. I tend to write as much functionality as possible in the server side (Python :) ) but in order to create rich user interfaces I have to use the client side (Javascript :( ) and things like this happens:
function addTopic(topic) { var input_attrs = { type: "checkbox", checked: "checked", name: "topics", value: topic, }; var li = Builder.node('li', [Builder.node('label', [Builder.node('input', input_attrs), topic.title])]); $("topic_list").appendChild(li); }
For those of you who are curious, yes I'm using Script.aculo.us and Prototype libraries here but here is the point: There is a syntax error in the previous code, one that Firefox (and thus Firebug) won't catch but one that Internet Explorer will. The funny thing is the Internet Explorer error message:
Error: Expected identifier, string or number
So, anybody can answer me: is the trailing comma a real Javascript syntax error or just another Internet Explorer flaw?