Let Go of Logic and "It Should"

Sometimes, code doesn’t do what it is supposed to, or what you expect. This is particularly common with open source code you didn’t write.

You can’t change the basic code architecture or data structures.

Key techniques to adapt and recover with javascript are instanceof and typeof. This allows you to test if an object or property has been created or assigned, and what type it is, then you can use it properly. Often, the best way to find out what types are being used is FireBug.

Take the time to look for examples in the code, so you don’t have to figure it all out from scratch. Usually, modifications to open source code involve code similar to that which is already in there, for example reassigning values.