Hi Ivan,
Based on the JS API reference, your question does not make sense.
Your example:
myTask.assignedTo(tw.system.org.findUserById(1234));
attempts to use the TWTask "assignedTo" as a method. It is not a method. It is a property - and does not accept any parameters.
If you are trying to perform an assignment, you have a choice of "reassignTo" methods for TWTask that accept a variety of parameters.
If you are trying to examine who the task is currently assigned to, then
myTask.assignedTo;
is supposed to return a TWUser or TWRole the Task is currently assigned to, according to the documentation:
BAW 19.0.0.3 JavaScript API in processes and service flows
#BusinessAutomationWorkflow(BAW)#Support#SupportMigration