Nine Javascript Gotchas

by Patrick Fitzsimmons

1) Comma Caused Coruption

<script>
var theObj = {
city : “Boston”,
state : “MA”,
}
</script>

Notice the comma after “MA”? It will be the source of many woes. Firefox will pay it no heed, but it will create a syntax error in IE. Worst of all, IE will not tell you where the actual bug is. The only soution is to scan through your entire 2,500 line javascript file trying to find that extra comma.

Read the rest of this entry »