Beginner questions on IF expressions and wildcard usage in function node

Okay, I got a step closer.
I cannot check for the key directly but first need to ensure that the object is actually present.

if (msg.payload.ENERGY !== undefined) {
    var msg = { payload: msg.payload.ENERGY['Power'] };
    return msg;
}

EDIT:
And in a second step then check the key.

This seems to work:

if (msg.payload.ENERGY !== undefined) {
    if (msg.payload.ENERGY['Power'] !== undefined) {
        var msg = { payload: msg.payload.ENERGY['Power'] };
        return msg;
}
}

Now I need to figure out the wildcard problem.