本文介绍了我想要这个定义的未定义程序的快捷代码。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将多个变量的快捷方法合并为一个语句,如



if(a,b,c === undefined)

{a,b,c =im not defined}

else {a,b,c =im defined};



我尝试过:



var a = 1;

var b =1;

var c =;

var d;



if(a === undefined)

{a =im not defined;}

else {a =im defined;};



if(b === undefined)

{b =im not defined;}

else {b =im defined;};



if(c === undefined)

{c =im not defined;}

else {c =im defined;};



if(d === undefined)

{d =我未定义;}

else {d =im defined;};



document.write(a +
+ b +
+ c +
+ d);



/ *我想要快捷方法* /


解决方案



i want a shortcut method for multiple variable into one statement like

if (a,b,c ===undefined)
{ a,b,c = "i m not defined"}
else {a,b,c = "i m defined"};

What I have tried:

var a = 1;
var b = "1";
var c = "";
var d;

if (a === undefined)
{a = "i m not defined";}
else {a = "i m defined";};

if (b === undefined)
{b = "i m not defined";}
else {b = "i m defined";};

if (c === undefined)
{c = "i m not defined";}
else {c = "i m defined";};

if (d === undefined)
{d = "i m not defined";}
else {d = "i m defined";};

document.write(a+"
"+b+"
"+c +"
"+d);

/* i want shortcut method for it */


解决方案



这篇关于我想要这个定义的未定义程序的快捷代码。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 03:24