it could.... but that's not really the best way... functions are meant to be used when it gets called elsewhere that basically performs the same task but with different numbers called parameters.... I'd recommend something like this
function loadLevel(lvl) {
switch(lvl) {
case 0: break;
default: console.log("No more levels or out of bounds error");
}
}
//that way you can designate that to import the levels in when you need them
var level = 0;
//in the main loop draw
function draw() {
switch(level) {
// and here you can test for constant behavior between levels
}
}