I would use the "typeOf" guard method.
It does not accept "truthy" arguments, so it depends on your function whether you can use it.
The tests are basically the same as czosel's answer, but his answer returns "truthy" while mine only accepts boolean true as true.
var tests = [
//filled string
'test',
//empty string
'',
//Numeric empty
0,
//Numeric filled
1,
//Null
null,
//Completely undefined
,
//undefined
undefined,
//Not-A-Number numeric value
NaN,
//Boolean true
true
];
for (var t = 0; t < tests.length; t++) {
var test = tests[t];
var results = {
test: test,
isTruthy: !!test,
isBoolTrue: (typeof test != "boolean" ? false : test),
isDefined: (test !== void 0)
};
console.log(results);
}
EDIT 1
Since the question could be interpreted in several ways, i have included a couple of more tests.
isTruthy matches czosel's answer. Registers truthy values like 1 as true.
isBoolTrue was my first interpretation where it checks strictly whether a value is boolean true.
isDefined simply returns if the variable contains anything at all.