Page 1 of 1

EOS cominbing/joining 2 variables

Posted: Wed Oct 21, 2020 2:49 pm
by cksfantasy
Hi All,

This one is doing my head in, how do you join 2 variables in EOS?

ie.

var Firstname = "Harry";
var Surname = "Potter";
var Fullname = Firstname + ' ' + surname

I'm sure it should be easy :innocent:

Thanks a mil!

Re: EOS cominbing/joining 2 variables

Posted: Wed Oct 21, 2020 3:02 pm
by Thamrill
Eos scripting engine should be plain JavaScript.

I don't know very much of JavaScript, but I found this: https://www.w3schools.com/jsref/jsref_concat_string.asp

Re: EOS cominbing/joining 2 variables

Posted: Wed Oct 21, 2020 3:12 pm
by cksfantasy
Thamrill wrote: Wed Oct 21, 2020 3:02 pm Eos scripting engine should be plain JavaScript.

I don't know very much of JavaScript, but I found this: https://www.w3schools.com/jsref/jsref_concat_string.asp
Legend! i thought i tried it... but nope! missed this one.

Thank you sir! you have fixed my problem.

Re: EOS cominbing/joining 2 variables

Posted: Wed Oct 21, 2020 8:13 pm
by fapnip
You can also just do:

Code: Select all

string1 = string1 + string2;
or

Code: Select all

var string3 = string1 + string2;
So the code in your first post should have worked, except for the typo of 'surname' vs 'Surname' in your concatenation.