function A(obj, opt1, opt2){ switch (!opt2) { case true: opt2="my string is : "+obj+" and it contains "+opt1; obj={}; opt1="options"; case false: alert(obj.a) obj[opt1] = opt2; break; } }