Edit in JSFiddle

function f(x) {
    function g() {
        return x;
    }
    alert(g());
}

f(5);