串联?我刚开始学习。我有chalange做。请帮助我 [英] Concatenating? I just started learning.i have chalange to do.please help me

查看:64
本文介绍了串联?我刚开始学习。我有chalange做。请帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用+运算符连接以下单词和数字。所有值都需要用空格分隔:





5



两个

3

7



结果字符串输出应为:8 5 6 2 3 7



我尝试过:



   8 +5+  六个 + 3 + 7 





我已经尝试了所有组合。我被卡住了

解决方案

不清楚你是如何得到这些值的,但你可能应该使用一个数组来保存它们......

  var  a = [' < span class =code-string> 8', 5 '  six'' 两个' 3  7 ]; 
a.join(' ');


首先研究文档总是一个好主意: JavaScript操作员 [< a href =http://www.w3schools.com/js/js_operators.asptarget =_ blanktitle =New Window> ^ ]。


最好的想法 - 这是非常基本的到javaScript - 你需要学习javaScript。 JavaScript教程 [ ^ ]


Use the + operator to concatenate the following words and numbers. All values need to be separated by a space:

"eight"
5
"six"
"two"
3
7

The resulting string output should be: "eight 5 six two 3 7

What I have tried:

"eight "+5+" six two "+3+7



I have tried all combinations.I am stuck

解决方案

Not clear how you got the values, but you probably should use an array to hold them...

var a = ['eight', 5, 'six', 'two', 3, 7];
a.join(' ');


It is always a good idea to study the documentation first: JavaScript Operators[^].


Best Idea - this is very basic to javaScript - you need to study javaScript. JavaScript Tutorial[^]


这篇关于串联?我刚开始学习。我有chalange做。请帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆