I thought it would be handy if I define my function, so that I can pass hashes to it. With the idea that later on when I extend my code I can easily pass more variables without having to change my other code that also executing this code.
Now I made an example, but somehow it won't work:
function test(data){
if(data.id){
$('body').append($('<p/>',{text: "hallo"});
}
};
test({id: 5, text: 4});
Fiddle: http://jsfiddle.net/HQ9P2/
What do I do wrong? And is this the right way to avoid cohesion in my code?