Javascript 如何强制将变量定义与否的检查转换为读取True或False的字符串?

Javascript 如何强制将变量定义与否的检查转换为读取True或False的字符串?,javascript,Javascript,我的控制台日志设置如下: console.log("getTestStatusActions" + this.userTestStatusActions === undefined); 这会将单个单词“False”作为输出 我如何使此输出为: "getTestStatusActions: userTestStatusActions defined" 或 三元 console.log("getTestStatusActions" + (this.userTestStatusActions ==

我的控制台日志设置如下:

console.log("getTestStatusActions" + this.userTestStatusActions === undefined);
这会将单个单词“False”作为输出

我如何使此输出为:

"getTestStatusActions: userTestStatusActions defined"

三元

console.log("getTestStatusActions" + (this.userTestStatusActions === undefined ? "undefined" : "defined"));
或者,为了可读性:

var status = this.userTestStatusActions === undefined ? "undefined" : "defined";
console.log("getTestStatusActions: userTestStatusActions " + status);
三元

console.log("getTestStatusActions" + (this.userTestStatusActions === undefined ? "undefined" : "defined"));
或者,为了可读性:

var status = this.userTestStatusActions === undefined ? "undefined" : "defined";
console.log("getTestStatusActions: userTestStatusActions " + status);
三元

console.log("getTestStatusActions" + (this.userTestStatusActions === undefined ? "undefined" : "defined"));
或者,为了可读性:

var status = this.userTestStatusActions === undefined ? "undefined" : "defined";
console.log("getTestStatusActions: userTestStatusActions " + status);
三元

console.log("getTestStatusActions" + (this.userTestStatusActions === undefined ? "undefined" : "defined"));
或者,为了可读性:

var status = this.userTestStatusActions === undefined ? "undefined" : "defined";
console.log("getTestStatusActions: userTestStatusActions " + status);