title: How to make push, unshift, pop and shift to work only with local array in javascript?
body: <p>I have a function to describe my problem:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function testingFunc(value) {
    var temp = value;
    console.log("temp before:    " + JSON.stringify(temp));
    console.log("arrayTest before:    " + JSON.stringify(arrayTest));
    temp.unshift(123);
    console.log("temp after unshift:    " + JSON.stringify(temp));
    console.log("arrayTest after unshift:    " + JSON.stringify(arrayTest));
    temp.push(456);
    console.log("temp after push:    " + JSON.stringify(temp));
    console.log("arrayTest after push:    " + JSON.stringify(arrayTest));
    temp.shift();
    console.log("temp after shift:    " + JSON.stringify(temp));
    console.log("arrayTest after shift:    " + JSON.stringify(arrayTest));
    temp.pop();
    console.log("temp after pop:    " + JSON.stringify(temp));
    console.log("arrayTest after pop:    " + JSON.stringify(arrayTest));
    return temp;
  }
  
  var arrayTest = [1,2,3,4,5];
  var arrayTestTwo;
  
  arrayTestTwo = testingFunc(arrayTest);
  console.log("arrayTest after testingFunc:    " + JSON.stringify(arrayTest));
  console.log("arrayTestTwo:    " + JSON.stringify(arrayTestTwo));</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you can see, <code>arrayTest</code> will change too if <code>temp</code> change by using <code>push</code>, <code>unshift</code>, <code>pop</code> and <code>shift</code> to edit it's data.</p>
  
  <p>But I want those function to work ONLY with <code>temp</code> and ignore <code>arrayTest</code>.</p>
  
  <p>Is it possible? Also is it possible to work with object contains functions?</p>
  
  <p>And why is this happen?</p>