Can't get this to work

Code:
function test(name = 'Boss'){
alert("Name is:"+name);
}

function test(name ){
if(name == ''){name='Boss'}
alert("Name is:"+name);
}
How can I set a default value???