function withBoxUnlocked(body) {
    var relock = false;
    if (box.locked) {
        box.unlock();
        relock = true;
    }

    try {
        return body();
    }
    finally {
        if (relock)
            box.lock();
    }
}

function withBoxUnlocked(body) {
    let wasLocked = box.locked;
    if (wasLocked) {
        box.unlock();
    }
    try {
        return body();
    } finally {
        if (wasLocked) {
            box.lock();
        }
    }
}

Add Chapter 08, exercise 2
Add Chapter 08, exercise 2
