Code choices: What's better?
Ala Snook prompt, which of the following sets of JavaScript do you prefer or think is better, and why?Passing Objects
Method A
var o = {
foo : 'bar',
baz : true,
bla : 1
};
fn(o);
Method B
fn({
foo : 'bar',
baz : true,
bla : 1
});
Min-height
Method A
/* ala http://www.dustindiaz.com/min-height-fast-hack */
selector {
min-height:500px;
height:auto !important;
height:500px;
}
Method B
selector {
min-height:500px;
}
* html selector {
height:500px;
}
DOM 'load' state
Method A
...
<style>
...
.dn {
display:none;
}
...
</style>
<body>
...
<div class="dn">
Method B
<div style="display:none;">
Function Declaration
Method A
function fn() {
// do stuff here
}
Method B
var fn = function() {
// do stuff here
};
recent
- Matador: The Obvious MVC Framework for Node
- Sandboxing JavaScript
- Crouching Ender, hidden command
- Ender.js - The open submodule library
- Qwery - The Tiny Selector Engine
- Klass
- Smallest DOMReady code, ever.
- $script.js - Another JavaScript loader
- About that slowness on Twitter...
- Autocomplete Fuzzy Matching
- JavaScript Cache Provider
- JavaScript Animate
- Asynchronous method queue chaining in JavaScript
- Something changed
- Unofficial Twitter Widget Documentation
i am dustin diaz

