Using `context` values with conditional comparisons

I am sorry if this is a repeat, but I just got caught on it again.

Given messages arrive with the required message structure. Not the same message. Two messages to set the two parts.

Example code:

context.set("one",msg.something);
context.set("two",msg.something_else);

if((context.get("one") !== undefined && context.get("two") !== undefined))
{
    //  what ever
}

Doesn't work.

Rather to get that to work, I need to write it like this:

var one = context.get("one");
var two = context.get("two");

if((one !== undefined) && (two !== undefined))
{
     //  what ever
}

Again: Sorry if it has been asked before.
What's happening to not allow this?