I am not an expert either so I may also be wrong in this explanation. The code ( P ) in the playground is executed by an overarching code (A) which retains some information about P so that pressing the play button runs P without re-loading A. Now the error you created by deleting new created a stored error in A so that re-running the code executed this stored error. Now whether this is a bug or a necessity of the way the playground works I do not know but @Deltakosh will.
Now to answer some of your comments
Using the browser refresh button will clear this problem.
You need the new keyword when the function you are calling is a constructor function. That is when you are creating an new instance of a class. Calling Scene you are calling a constructor function.
There are also static functions, these are in a sense helper functions where you pass some parameters and the static function uses a constructor function to create a new instance and uses the passed parameters to set specific properties for the instance. For example MeshBuilder.CreateBox is a static function that calls the constructor for a Mesh and having created an instance of a new Mesh uses the parameters to set the vertex positions, normals, indices and uvs of a box mesh.
Hope that helps.
It is a good thing to learn by experimenting and seeing what works and what doesn’t. What you have to be prepared for is that breaking fundamental structures might produce errors that designers never expected to happen and you cannot get out off. In which case you have to switch off and on again, ie refresh the browser.
Good learning and keep experimenting and asking when unsure ![]()