Click here to Skip to main content
15,924,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

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


I have tried all combinations.I am stuck
Posted
Updated 31-Oct-16 0:48am
v3
Comments
[no name] 30-Oct-16 7:03am    
I am not familiar with js but basically you need to replace CRLF \N\R with a Space Character

Not clear how you got the values, but you probably should use an array to hold them...
JavaScript
var a = ['eight', 5, 'six', 'two', 3, 7];
a.join(' ');
 
Share this answer
 
It is always a good idea to study the documentation first: JavaScript Operators[^].
 
Share this answer
 
Best Idea - this is very basic to javaScript - you need to study javaScript. JavaScript Tutorial[^]
 
Share this answer
 
Try this:
JavaScript
var x = 'eight' + ' ' + 5 + ' ' + 'six' + ' ' + 'two' + ' ' + 3 + ' ' + 7;
alert(x);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900