It's ensuring a default value basically. If you instantiate a person without an argument and try to reference this.gender later, you'll throw a script error. This is just avoiding that.
A way I'd prefer might look like this:
function Person = function(gender) {
this.gender = gender || 'neuter' //the sauce that defines a fallback
}
This is not the case, because in the constructor person is being set to the argument. If the argument is not supplied (undefined), calling the instantiated object's gender property will result in undefined. [tested and confirmed]
Oh man... the Rhino is a good reference, but lacks all kinds of best practices and essential style pieces.
Between 'proper' OO style, short circuiting on falsey assignment (var a = b || "default"), checking existence to avoid errors ( if (myObject && myObject.getJSON()){//block to deal with JSON} ) and the DOM, I feel like this is only useful to look up the Date() and Math() methods.
Sorry, just griping because it was the first 'real' programming book I got, and I feel that it misled me for quite a while. </rant>
You know, I was nodding my head as I read the OPs progression. The first programming I ever tried was Rails (it's the hotness, why not dive in!). My problem was that it was magically solving problems I didn't know I had.
I would strongly argue for (if you have time) experiencing the progression of web dev to its current state from the ground up. Understand WHY templating is useful. Understand that most basic CRUD controllers have the same methods, and the schema underneath is setup the same way. Doing some things the 'hard' way I found made it much easier to understand the reasoning behind today's most modern frameworks. I understood their benefits.
The truth is, despite my reply suggesting going straight to framework, going the from scratch is good if you're able and are willing to invest the time. But if you've got work to do, some times you need to learn as you work rather than learning first. Its in those cases that I recommend the framework route--with the caveat that you accept that theres a reason for the framework's complexity. Don't bulk at it, realize that its there for reasons you may not understand.
Luckily you'll gain "from scratch" experience even through the framework route anyways, since it naturally comes when you have create things that expand the scope of capability of your framework. Even when you are simply extending base classes of the framework, your addressing and solving problems that the base framework doesn't answer.
Incidentally, as a webdev who targets big businesses, they in fact usually have -slow- computers. Javascript in IE 6 is pokey, and typical use-cases of Outlook and Excel don't need much firepower.
A joe-blow at home on the other hand is either at least at the "corporate" level, or even higher for gaming or media-centering.
A service that has no backend (no server calls, DB, 'scary' stuff to consumers) that lets you back up your tweets on your own terms. Basically gives you ownership of things you write, without relying on any third party to access, store, or send you your own writing. Eventually will be given out as a folder with some .js and .html files, all self contained.
The Lorem Ipsum book store in Cambridge, MA does just this. It was started by some MIT kids (afaik) with some basic algorithms set up to judge the "goodness" of a book when they go to sales or get turn-ins from customers for store credit. They don't solely include the Amazon sale price of a book though, somehow they definitely include unique-ness or coolness: their store is stuffed to the gills with amazingly interesting books on all topics (all of which are cross listed on Amazon also).
Seems to work for them. How many other independent bookstores have gone under lately? When I moved out of Cambridge last year, Lorem Ipsum was just upgrading to a new, larger facility.
At the beginning of the learning curve, there's little better for grasping topics than hearing someone else explain them. I've learned more (almost entirely by virtue of genius co-workers) in the first 6 months of my current, first, developer job than I did in ~2 years of self learning and freelancing.
A way I'd prefer might look like this: