如果我在javascript中有以下内容..
var one = 600;
var two = "mins";
如何达到等于" 600分钟"?
的结果答案 0 :(得分:3)
var one = 600;
var two = "mins";
var result = one + two;
答案 1 :(得分:0)
只是连接两个变种:
var one = 600;
var two = "mins";
var result = one + two;
答案 2 :(得分:0)
var one = 600;
var two = "mins";
console.log(one + two); // "600mins"
答案 3 :(得分:0)
你的意思是这样的:
var result = one + two;
结果将等于" 600分钟"
希望这有帮助
答案 4 :(得分:0)
只需将它们加在一起即可。 JavaScript会自动将数字转换为字符串,将其添加到" mins",结果是字符串。
var one = 600;
var two = "mins";
var three = one + two; // value of three is now "600mins"
答案 5 :(得分:0)
你可以将它们连接起来以获得" 600分钟" (没有引号)
var one = 600;
var two = "mins";
var three = one + two
如果你想用引号括起来,你可以这样做:
three = "\"" + three + "\"";
答案 6 :(得分:0)
var one = 600;
var two = "mins";
var result= one.concat(two);
if(result == "600mins")
alert("It works");
这就是你想要的吗?