I don't get this!
The function messup() is supposed to alter copy, not original. What do I do wrong?
<head>
<script src="../js/jquery-1.11.0.min.js"></script>
<script>
function messup(copy) {
copy[0] ++;
console.log(original);
$('.putContentHere').html('<button class="plus">+</button>');
}
var original = [1, 1];
var copy = original;
$(document).ready(function() {
messup(copy);
$('html').on('click', '.plus', function() {
messup(copy);
});
});
</script>
</head>
<body>
<div class="putContentHere"></div>
</body>
How can I preserve the original while the copy is being messed up?