Refactor this loop to do more than one iteration

Here I am trying to find the four diagonally adjacent numbers in a 20*20 grid whose product is the greatest. Diagonals run from upper left to lower right. But something is wrong with the first loop: it does not iterate over the array. I could not find what it is.

function fouradjacentFinder(){
  let mystring = "08 02 22 97 38 15 ..."
   let  myarray  = mystring.split(" ").map(x =>Number(x));
    let counter ;
     let max = -Infinity;


 for(let i = 0;i<myarray.length;i++){
   counter= 0 ;

   for(let k =21;;k+21 ){
    myarray[i] = myarray[i]*myarray[k];
       counter++

     if(counter>4){
        break;
       }

   if(myarray[i]>max){
     max = myarray[i] ;
   }
   console.log(max)
  

 }
 return max;
 }
}

246 thoughts on “Refactor this loop to do more than one iteration”

  1. Pingback: diet coke keto
  2. Hi, There’s no doubt that your site might be having web browser compatibility problems.
    When I look at your website in Safari, it looks fine however when opening in IE, it has some overlapping issues.

    I merely wanted to provide you with a quick heads up!
    Apart from that, great website!

    Reply
  3. After checking out a handful of the blog posts on your web site, I really appreciate your technique of writing a blog.
    I added it to my bookmark website list and will be checking back soon. Please visit my web site as well and
    tell me how you feel.

    Reply
  4. I’m not that much of a online reader to be honest but your blogs really nice, keep
    it up! I’ll go ahead and bookmark your website to come back in the future.
    Many thanks

    Reply
  5. Howdy! This is kind of off topic but I need some advice
    from an established blog. Is it difficult to set up your own blog?
    I’m not very techincal but I can figure things out pretty quick.

    I’m thinking about making my own but I’m not sure where to start.
    Do you have any tips or suggestions? Thanks cheap flights http://1704milesapart.tumblr.com/ cheap
    flights

    Reply
  6. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that
    automatically tweet my newest twitter updates. I’ve been looking for a plug-in like this
    for quite some time and was hoping maybe you would have some
    experience with something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to
    your new updates. ps4 https://bitly.com/3nkdKIi ps4 games

    Reply
  7. fantastic put up, very informative. I ponder why the other specialists of this sector don’t understand this.
    You should continue your writing. I’m confident, you’ve
    a huge readers’ base already!

    Reply
  8. Oh my goodness! Awesome article dude! Thanks, However I am having troubles with
    your RSS. I don’t know the reason why I can’t join it.

    Is there anybody getting similar RSS problems? Anybody
    who knows the solution will you kindly respond? Thanks!!

    Reply
  9. I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do
    it for you? Plz answer back as I’m looking to create my own blog and
    would like to find out where u got this from.
    cheers

    Reply
  10. Hi there! I could have sworn I’ve been to this site before but after
    reading through some of the post I realized it’s new to me.
    Anyways, I’m definitely happy I found it and
    I’ll be book-marking and checking back frequently!

    Reply
  11. Good day! I could have sworn I’ve been to this site before but after reading through
    some of the post I realized it’s new to me. Nonetheless, I’m definitely glad I found it and I’ll be bookmarking and checking back frequently!

    Reply
  12. I do agree with all of the concepts you’ve offered for
    your post. They’re really convincing and will definitely
    work. Still, the posts are very quick for starters.
    May you please extend them a little from next time?
    Thank you for the post.

    Reply
  13. hello!,I really like your writing very a lot!
    proportion we be in contact more approximately your article on AOL?
    I need an expert in this space to unravel my problem.

    Maybe that’s you! Taking a look ahead to see you.

    Reply
  14. Have you ever considered about adding a little bit more
    than just your articles? I mean, what you say is important and everything.
    But think about if you added some great pictures or
    video clips to give your posts more, “pop”!
    Your content is excellent but with images and video clips,
    this website could undeniably be one of the most
    beneficial in its niche. Fantastic blog!

    Reply
  15. I have been a yahoo users for some years now. I am only starting to make use of the tools which they provide, one of which being blog posts. I have written a blog and would like to know if my blog posts are being seen by others. If not then does anyone know how I get my blogs posts read..

    Reply