We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This is the code in JavaScript **
**All the suggestions are highly appreciated
functionbreakingRecords(scores){letturn=0;letminScore=0;letmaxScore=0;lethighRec=0;letlowRec=0;letresult=[];for(letiofscores){if(turn==0){minScore=i;maxScore=i;turn+=1;// console.log('turn increased by 1 and setted initial scores',i);}else{if(i>maxScore){// console.log(`the maxScore was ${maxScore} and i is ${i} `)maxScore=i;highRec+=1;// console.log(`the maxScore is ${maxScore} setted equal to i ${i} `)}elseif(i<minScore){// console.log(`the minScore was ${minScore} and i is ${i} `)minScore=i;lowRec+=1;// console.log(`the minScore is setted to ${minScore} equal to i ${i} `)}}}result.push(highRec);result.push(lowRec);returnresult}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Breaking the Records
You are viewing a single comment's thread. Return to all comments →
This is the code in JavaScript ** **All the suggestions are highly appreciated