Have you suffered from the pain of debugging SharePoint Client Object Model (COM) in Javascript? If you haven’t.. I think you soon will.
The SP COM introduces lots of classes in Javascript. Although you can add some basic intellisense for VS for the SP COM (see http://msdn.microsoft.com/en-us/library/ff798328.aspx), you will quickly find that it is no where near good enough.
I found that being able to get the class name of a variable in Javascript helps when debugging. In IE8, you can do this with: myObj.constructor.__typeName.
For the code below for example, doing alert(appointments.constructor.__typeName) would tell me that it is of type “SP.ListItemCollection”, and doing alert(appointmentEnumerator.constructor.__typeName) would tell me that it is of type “SP.ArrayListEnumerator”. This also works for simple types such as Number and string.
function getAppointmentOnSucceeded(sender, args) { var appointmentEnumerator = appointments.getEnumerator(); while (appointmentEnumerator.moveNext()) { var appointment = appointmentEnumerator.get_current(); $get("appointmentDetails").innerHTML += "</br><b>" + appointment.get_item('Title') + "</b><br/>" + appointment.get_item('Description'); } }