three.js script won't work
<p>I'm reading a book "Learning Three.js - The JavaScript 3D Library for WebGL - 2nd Edition" and first example in book which is not working at all.</p>

<p>Can someone please give me a direction why? I'd tried with <a href="https://superuser.com/questions/836832/how-can-i-enable-webgl-in-my-browser">"How can I enable WebGL in my browser?"</a> and it didn't help. But examples on <a href="http://threejs.org/examples/" rel="nofollow noreferrer">three.js / examples</a> are working as they should.</p>

<p>I've extracted three.js and put example bellow in build folder where three.js is located.</p>

<p>Do I need local web server to test WebGL?</p>

<p>Now I try to debug and code in Visual Code. Any other recommendations?</p>

<p></p>

<pre><code>&lt;html&gt;

&lt;head&gt;
    &lt;title&gt;Example 01.02 - First Scene&lt;/title&gt;
    &lt;script type="text/javascript" src="three.js"&gt;&lt;/script&gt;
    &lt;style&gt;
        body {
            /* set margin to 0 and overflow to hidden, to go fullscreen */
            margin: 0;
            overflow: hidden;
        }
    &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;!-- Div which will hold the Output --&gt;
&lt;div id="WebGL-output"&gt;
&lt;/div&gt;

&lt;!-- Javascript code that runs our Three.js examples --&gt;
&lt;script type="text/javascript"&gt;

    // once everything is loaded, we run our Three.js stuff.
    function init() {

        // create a scene, that will hold all our elements such as objects, cameras and lights.
        var scene = new THREE.Scene();

        // create a camera, which defines where we're looking at.
        var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);

        // create a render and set the size
        var renderer = new THREE.WebGLRenderer();
        renderer.setClearColorHex();
        renderer.setClearColor(new THREE.Color(0xEEEEEE));
        renderer.setSize(window.innerWidth, window.innerHeight);

        // show axes in the screen
        var axes = new THREE.AxisHelper(20);
        scene.add(axes);

        // create the ground plane
        var planeGeometry = new THREE.PlaneGeometry(60, 20);
        var planeMaterial = new THREE.MeshBasicMaterial({color: 0xcccccc});
        var plane = new THREE.Mesh(planeGeometry, planeMaterial);

        // rotate and position the plane
        plane.rotation.x = -0.5 * Math.PI;
        plane.position.x = 15;
        plane.position.y = 0;
        plane.position.z = 0;

        // add the plane to the scene
        scene.add(plane);

        // create a cube
        var cubeGeometry = new THREE.BoxGeometry(4, 4, 4);
        var cubeMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, wireframe: true});
        var cube = new THREE.Mesh(cubeGeometry, cubeMaterial);

        // position the cube
        cube.position.x = -4;
        cube.position.y = 3;
        cube.position.z = 0;

        // add the cube to the scene
        scene.add(cube);

        // create a sphere
        var sphereGeometry = new THREE.SphereGeometry(4, 20, 20);
        var sphereMaterial = new THREE.MeshBasicMaterial({color: 0x7777ff, wireframe: true});
        var sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);

        // position the sphere
        sphere.position.x = 20;
        sphere.position.y = 4;
        sphere.position.z = 2;

        // add the sphere to the scene
        scene.add(sphere);

        // position and point the camera to the center of the scene
        camera.position.x = -30;
        camera.position.y = 40;
        camera.position.z = 30;
        camera.lookAt(scene.position);

        // add the output of the renderer to the html element
        document.getElementById("WebGL-output").appendChild(renderer.domElement);

        // render the scene
        renderer.render(scene, camera);
    }
    window.onload = init;

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>