The ugly code underneath represents the problem I'm facing. How to properly implement the situation, where 1 and 2 is displayed unconditionally, whilst 3 only after the certain condition is met.
function one() {
    console.log('1');
    console.log('2');
    two();
    console.log('3');
}
function two() {    
    while (true) {
        if (document.cookie.indexOf('SOMECOOKIE=') != -1) {            
            break;
        } 
    }
}
