They are both good answers, depending on what you're looking for. The first is clear, concise, and correct -- pretty much exactly what you want to read and write code with the $ prefix.
The other one is more interesting in a behind-the-scenes way, and goes through the thinking process behind it.
I can see why the first answer gets the most votes -- that's usually all people want. The other gets votes for the people looking for a somewhat deeper answer and are willing to spend more time reading to get it.
It shouldn't necessarily be about winning the voting... different perspectives are useful.
They are both good answers, depending on what you're looking for. The first is clear, concise, and correct -- pretty much exactly what you want to read and write code with the $ prefix.
The other one is more interesting in a behind-the-scenes way, and goes through the thinking process behind it.
I can see why the first answer gets the most votes -- that's usually all people want. The other gets votes for the people looking for a somewhat deeper answer and are willing to spend more time reading to get it.
It shouldn't necessarily be about winning the voting... different perspectives are useful.