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

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -