Sometimes you want to find out what members an object exposes. There's a pretty simple way to do this. A simple for-in statement.
PLAIN TEXT
CODE:
for(var member in obj){ alert(member); };
No really, that's it. No "imports" or "using" statments. No complicated classes to memorize, no unwrapping or casting. Just for-in over an object. One caveat, this [...]
For various reasons, developers through the years have decided to store lists of data as comma-separated lists. Most programming languages include a split() function that allows you to break apart a list of data using a specified character. T-SQL does not.
I don't remember where I got this split function from. I know I didn't [...]
In my last post on constructors and objects in JavaScript, I mentioned that the logical OR operator || was short-circuited and allowed us to set default values for arguments passed into the constructor. So we know that the argument evaluates to false if we don't pass it in to the constructor, but what value does [...]
JavaScript doesn't have a "class" keyword or any formal class construct. Instead, functions are 1st class objects. When you write a function, you are essentially writing a constructor for a new object.
Here we are defining a object constructor called "newClass" and assigning some member values.
PLAIN TEXT
CODE:
function newClass() {
this.name = "newClass";
[...]