Script Condition Returns null and not work with Default flow, also setTimeout in JS not defined

Hello, i am using script both as flow conditions and tasks.

Problem1: when i call setTimeout() it returns setTimeout is not defined

Problem2: using exclusive gateway with JS scripts in flow conditions. I have one exclusive gateway with 2 branches. The first branch has a script condition if (execution.getVariable(x)<10){true} and the 2nd branch if (execution.getVariable(x)>=10){true}. It returns a rest message “condition script returns null: result is null”. However if i put the an else condtion on 2nd branch e.g. if (execution.getVariable(x)>=10){true}else{false} , it returns no errors.

My concerning: The above conditional problem not happens in similar exclusive gateways. The exclusive gateway is also a nested exclusive gateway of another branch. So what is exactly the case?