Locking levels on a level map?

Hey guys I created a map with the levels of my game, now all is working perfect and all the levels are accesible but I want to check if the level one has been completed to unlock the second one for that I created some variables:

var level1Completed : boolean = true;

var level2Completed : boolean = false;

var level3Completed : boolean = false;

var level4Completed : boolean = false;

var level5Completed : boolean = false;

var level6Completed : boolean = false;

If the 1 level has been completed you can go to the second.

The problem is that I dont know how to check if the level has ever been finished, any ideas??

maybe like this can work:

var listoflevels : boolean[];//all except first one with the value of 0
var actualevel = 0;
if(/*you pass the level*/){
actualevel++;
listoflevels[actualevel] = true;//actualevel is a variable that says the the levels that are completed at the time
}
if(listoflevels[levelschosen] == true){//levelchosen is the level you want to access 
//pass(means that this level is not locked)
}else{
Debug.Log("This level is looked");
}

This just an idea, too use a variable to put values of things already done.

And for see if it finished I will put an spawn or an object like a invisible wall that has collision and check if the player goes there(check collision) and set the level as finished