How can I store looped data into an array in java : Firstly I am a beginner in java script. I want to store all the looped data into the Course_Code and Grade arrays. everything works except that  only the last entered value is store. what must i do to save all the data in the array.
<script>


    const MIN = 999;
    const MAX = 10000;
    const minLet = 64;
    const maxLet = 91;
    const GRADE_VALUE = 'parseInt(7)%parseInt(6)%parseInt(5)%parseInt(4)%parseInt(3)%parseFloat(1.5)';
    var i;
    var j;
    var Grade = new Array();
    var Course_Code = new Array();
    
    while (willingnes != false)
     {
    var willingnes = confirm('Do you want to enter new Course Code? Click OK to continue or Cancel to stop?');
    
    if(willingnes == true)
     {
     
    Course_Code = prompt('Enter your Course Code','AAA1000');
    var Digits = parseInt(Course_Code.slice(-4)); // extract the last four digits from course code
    
    while(Course_Code.charCodeAt(0)<minLet || Course_Code.charCodeAt(0)>maxLet || Course_Code.charCodeAt(1)<minLet || Course_Code.charCodeAt(1)>maxLet ||Course_Code.charCodeAt(2)<minLet || Course_Code.charCodeAt(2)>maxLet || isNaN(Digits) || Digits<MIN || Digits>MAX) {
        alert('Your input was invalid');
    Course_Code = prompt('Enter your Course Code','AAA1000');
    }
    
    Grade = prompt('Input a valid Course grade:');
    				while(GRADE_VALUE.indexOf(Grade)<0){
    					alert('Invalid Course value.');
    					Grade = prompt('Re-enter valid course grade:');
    					}				
    }
    }	
    
    alert(Course_Code);
    alert(Grade);

</script>