var funTimes = ["The Dentist", "The Flu", "Hunting", "Fishing", "A Prostate Exam"];
Because this is a standard array you would get at "Hunting" by saying funTimes. An associative array is a collection of key, value pairs. So I could have:
var moreFun = new Array();
moreFun["Hunting"] = "Deer";
This outputs: "Name, Gender, Occupation, FavoriteFood"
- Next having seen the for/in combo in action, you might know what is coming up next! The difference between the statement information["FavoriteFood"] and information.FavoriteFood is purely syntax. This allows the following:
...but wait... if that works then....
This has an amazing result, it prints every variable in the object you call VulgarDebug on with the associated value! This includes functions, even VulgarDebug itself! (I did add a condition to remove VulgarDebug = ... from the JSFiddle but you can easily comment it out and see for yourself)
The awesomeness doesn't just end there... The sky is the limit and the power is at your finger tips.
JQuery exposes a method called "extend" which will over-write or "extend" properties of one object into another object and merge the two together. This is really neat for many reasons even past the really off the wall dumb example I am using it in!
Well that is all I have for tonight! Please feel free to start commenting with requests of additional topics you would like to see me cover. If it is not something I know I will do the research and we can discover it together! Always keep pushing the boundaries and never stop learning!
(We shall see if the JSFiddle embeds below, if it does... these are the live samples I have screen shots shown above)