Found the wright way to write the code for the the code of the function node here.
Now my code looks like:
msg.params = [
['2006d991d90ff991fb772ccc649f8dfcf316ac51'], /* DeviceIds Array (but it can only handle one device id) */
{ play: true } /* Options Object */
];
return msg;
Node red flow
[{"id":"9fcff8a1.e11c18","type":"debug","z":"1ec70ae1.ce8cc5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":890,"y":460,"wires":[]},{"id":"6e3b8927.c4256","type":"spotify","z":"1ec70ae1.ce8cc5","name":"","auth":"daae9818.5d9dc8","api":"transferMyPlayback","x":720,"y":460,"wires":[["9fcff8a1.e11c18"]]},{"id":"c3fde82d.b7bc38","type":"function","z":"1ec70ae1.ce8cc5","name":"Naar woonlamer","func":"\n\nmsg.params = [\n ['2006d991d90ff991fb772ccc649f8dfcf316ac51'], /* DeviceIds Array (but it can only handle one device id) */\n { play: true } /* Options Object */\n];\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":460,"wires":[["6e3b8927.c4256"]]},{"id":"45085da9.3094f4","type":"inject","z":"1ec70ae1.ce8cc5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":320,"y":460,"wires":[["c3fde82d.b7bc38"]]},{"id":"daae9818.5d9dc8","type":"spotify-auth","name":"Spotify Sander","scope":"user-read-playback-position\nuser-read-playback-state\nuser-modify-playback-state\nuser-read-currently-playing\napp-remote-control\nstreaming"}]
Maybe this will help someone.