Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'
<p>I am making a small game using Javascript in which there are two sides.In the left side there are 5 pics and in the right side there are 4 pics.When the user clicks on the missing picture on the left side then the game goes to the next level.I haven't written the full code yet.I have written the following code</p>

<pre><code>&lt;!--smile game--&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;Matching Game part3&lt;/title&gt;
        &lt;meta charset = "UTF-8"&gt;
        &lt;style&gt;
            img
            {
                position: absolute;
            }
            div
            {
                position: absolute;
                width: 500px;
                height: 500px; 
            }
            #rightside
            {
                left: 500px;
                border-left: 1px solid black;
            }

        &lt;/style&gt;

    &lt;/head&gt;
    &lt;body id ="theBody" onload="generateFaces();"&gt;
        &lt;h1&gt;Matching Game&lt;/h1&gt;
        &lt;p&gt;Click on the extra smiling face on the left&lt;/p&gt;
        &lt;div id="leftside"&gt;&lt;/div&gt;
        &lt;div id="rightside"&gt;&lt;/div&gt;

        &lt;script&gt;
            var numberOfFaces = 5;
            var theLeftSide = document.getElementById("leftside");
            var theRightSide = document.getElementById("rightside");
            function generateFaces()
            {
                for(var i =0; i&lt;numberOfFaces; i++)
                {
                    var image = document.createElement("img");
                    image.src = "http://home.cse.ust.hk/~rossiter/mooc/matching_game/smile.png";
                    image.style.top  = Math.floor(Math.random() * 400) + "px";
                    image.style.left  = Math.floor(Math.random() * 400) + "px";
                    document.getElementById("leftside").appendChild(image);
                }
            }

            leftsideimages = theLeftSide.cloneNode(true);
            leftsideimages.removeChild(leftsideimages.lastChild);
            theRightSide.appendChild(leftsideimages);

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

<p>And I am getting the error</p>

<blockquote>
  <p>Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.</p>
</blockquote>

<p>I have gone through the two other posts here on Stack Overflow but cannot understand how to fix my error.In the code I am first clong all the images and then removing the last child and then adding all the images to the right side so that it can be 1 less.So if anyone could help.
Thanks in advance.</p>