Calculate product of x and y or sum of x and z, using function f.

JavaScript

function f(m = null) {
        let x = 5, y = 3, z = 11;
        if (m) return m({ x, y, z });
    }
    
    console.log(f(function ({ x, y }) { return x * y;}));
    console.log(f(function ({ x, z }) { return x + z;}));