@stratos said:Not only is JavaScript tricky and fun, When in combination with websites it's also very browser dependant.For instance, i had this super Ajaxy super thing i needed to put in a form, where i rewrote some options based on other choices. (in other words, a list of checkboxes that got re-wrote based on a dropdown list selection)everything nice and dandy, then the checkboxes needed to be replaced by a dropdown, because of design constraints.But since that's basically the same i kept most of the old code.So first i just used innerHTML on the select element to write new options into it.IE6&7 didn't register the new options when submitted.Then i rewrote a bit of the function and just rewrote the whole select form element.Firefox didn't liked this idea and wouldn't send it when submitted.So then i had to rewrite most of the code to actually do it all in JS, and create new options for the existing select form element. But then again, perhaps i should have been using the HTML DOM from the start instead of just inserting new HTML manually. You just happened to have problems with something that's not actually related to Javascript, the language, at all. :)But it's true that adding options to a select has its issues. @JvdL said:stuffNote the existence of the typeof operator (which, contrary to common belief, is a unary operator, not a function), which will return "undefined" when a ariable is undefined. The fact that Javascript evaluates common "empty" values to false*, and that its || operator returns the first "true" value or the last one, make the sloppy typing in JS more bearable.A really tricky thing is that JS distinguishes between undefined and undeclared. Consider these two scripts:============//onevar foo;alert(foo);============//twoalert(foo);============ The first one will alert the string "undefined" because of JS's automatic type conversion (often more a curse than a blessing)The second one will throw an error, saying that foo is undefined! This behaviour is absent for "undeclared" properties in maps. In a sense, all possible properties you could even think of are implicitly declared (but not defined) in JS maps. *) but, interestingly, empty arrays and empty objects/maps evaluate to true. In fact, typeof Array -> "object"