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

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -