use ternary operator with correct precedence to assign default value to cookie