title: how to clear old text on p5js canvas
body: <pre><code>var j=0;
      function keyPressed() {                 
              word[j] =key;
              j++;
  
              if(keyCode == BACKSPACE){           
                  shorten(word);
                  shorten(word);
                  arrayCopy(word, contents);          
              }
              else{
                  contents=key;
              }
  
      }
      function draw(){
          text(contents, pos_x, pos_y, 300, 300); 
          pos_x = pos_x + textWidth(contents);
      }
  </code></pre>
  
  <p>when i am using backspace key,i use shorten() to remove the last element of array.how to put this new text on the canvas,without calling clear() and background().</p>