M
M
massshka2020-10-31 18:25:56
JavaScript
massshka, 2020-10-31 18:25:56

String concatenation?

for example, there is this. expression
let I = 'b'+'a'
is it possible to somehow refer to a and b? (except for working with a ready-made string i)
for example, by array index or something else
in a real example, these are strings of different content and length

Answer the question

In order to leave comments, you need to log in

5 answer(s)
F
forgotten, 2016-05-26
@forgotten

.then - asynchronous operation

P
Pavel Kornilov, 2020-10-31
@mashka_1308

I don't know if I understood the question correctly:

var a= 'a', b= 'b';
b= b.toUpperCase();
var i= a+b;

R
Robur, 2020-10-31
@Robur

no
PS. but you can save these 'a' and 'b' in separate variables before, concatenate them, but the original strings will remain in these variables

D
DPS_ninja, 2020-10-31
@DPS_ninja

If I understand the question correctly, then something like this
const a = 'Mary';
const b = 'Hello';
console.log(`${a}, how are you? ${b}`);
console log(a+b);
console log(a);
console log(b);

K
Karpion, 2020-11-01
@Karpion

I didn't understand the question. Where do these lines come from?
After the merging, it is no longer possible to divide back, since the Iinformation about the gluing boundary has been lost in the variable. But it is possible if this information is stored somewhere - for example, in the form of the length of at least one of the original strings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question