Construct now defaults to running your projects in a Web Worker for performance reasons.
For scripting this means a more limited set of methods are available. It's described in the manual in the 'Worker mode' section of JavaScript in Construct.
The easiest thing to do is untick 'Use worker' in Project Properties.
Also note when you create a new project, if you choose to start with script 'Use worker' is already turned off.
A better place to start would be to try using console.log("Hello world!")
which is supported in a worker as well.