s1 = "my number is "; s2 = 5; how to add this two variables to s3 by JavaScript.
Jump to turn (14)
- 1s1 = "my number is "; s2 = 5; how to add this two variables to s3 by JavaScript.
- 2window.location.href = "" any limit on the text I can pass to href?
- 3javascript number to string
- 4window.location.href = “” why it will break if I pass "=" to href?
- 5how to pass "="?
- 6CSS BACKGROUND COLOR ingredient
- 7css background-color effect
- 8webmanifest background image
- 9javascript, how to assign two dimension array? please give me an example
- 10for the first dimension, can I use a name instead of index number? let say group
- 11can I access the same value with the name or index number?
- 12how to return the array index which match the value?
- 13suppose I have below array: const adsContent = [{ releasename: 'sggt', name: 'A-
- 14thank you very much
- User
s1 = "my number is "; s2 = 5;
how to add this two variables to s3 by JavaScript.
- Assistant
There are multiple ways to concatenate these two variables into s3 using JavaScript, but here are two common ways:
- Using the
+operator:
codevar s1 = "my number is "; var s2 = 5; var s3 = s1 + s2; // concatenation console.log(s3) // output: "my number is 5"- Using template literals:
codevar s1 = "my number is "; var s2 = 5; var s3 = `${s1}${s2}`; // string interpolation console.log(s3) // output: "my number is 5"Both ways will result in s3 holding the concatenated string "my number is 5".
- Using the
- User