Combining multiple strings in Javascript
I have 3 strings in my js code listed as below:
var code : String = "";
var code1 : String = "";
var code2 : String = "";
I later change what they say depending on what happens and i want to know how i can combine them all into 1 string with some other text. I want to put "-" between them.
Another example could be a talking situation where i want it to say "Hello, 'string'. nice to see you again. Are you feeling 'string1'
Also i need to print these out and not just put it in a console log if that helps
Answer by Ian-McCleary · Nov 26, 2015 at 01:53 AM
I actually just found my answer by messing around a bit. This is the code i cam up with:
var codet = code1 + "-" + code;
and i put it inside my function instead of at the top of the script.
Hope this helped anyone else looking!
Your answer
Follow this Question
Related Questions
A certain string is causing trouble! (Javascript) 0 Answers
String Array = Anything? 1 Answer
GameObject, Select Parent As Object 0 Answers
Problem with Contains 0 Answers
How would I load a new scene when a score that is scored in a string is reached? 2 Answers