javascript - array.push adding key named push -
what missing here? shouldn't push 'hi' [4] instead of naming key named 'push'?
<script> array = ["banana", "orange", "apple", "mango"]; array.push = ('hi'); console.log(array); </script>
you should -
var samplearr = ["banana", "orange", "apple", "mango"]; samplearr.push('hi'); console.log(samplearr );
Comments
Post a Comment