Dont understand what is this push method?


var text = "hatim hatim hatim";
var myName = "hatim";
var hits = [] ;
for(var i = 0; i < text.length; i++);{
if(text[i] === "h"); {
for(var j = i; j<myName.length + i; j++); {

please assist how does the hits.push work? thank you


The push() method adds new items to the end of an array, and returns the new length.
So, you're adding the returned names to the array "hits."

Hope I helped, wish I could explain better. :slight_smile:


HI, alright, but how do i code it then?


What do you mean with "how do I code then" ?


This topic was automatically closed after 7 days. New replies are no longer allowed.