title: How to add z index to canvas.drawImage in js (I want to display myImages always at the top)
body: <p>Can we add z index to drawImage in javaScript ??? if we add can you explain?? </p>
  
  <pre><code>function drawCanvas(time, myClass, myImages, context) {
      drawImageWithCenter(myClass.bgImage, 512, 384);
      var indx;
      for (indx=0; indx &lt; 5; indx++){
          if(a[indx] == false){
              drawImageWithCenter(
                  myClass.rightImage, tickX[indx], tickY[indx]);
          }
      }
      for (indx=0; indx &lt; myImages.length; indx++)
      {
          if(myImages[indx].isVisible){
              drawImageWithCenter(myImages[indx].img[myImages[indx].currentFrame],myImages[indx].imgX,myImages[indx].imgY);
          }
      }
  
      if(spoted==5 &amp;&amp; B_end==true){
          drawImageWithCenter(myClass.endPopup, 512, 384);
      }
      context.font = "30px Gill Sans";
      drawCenterText("Spot the 5 differences in the pictures on the right...", 150, 80);
      drawCenterText("Score: " + spoted, 30, 50);
  }
  </code></pre>