All language subtitles for 10. String Concatenation

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

0 All right. 1

So in this module we're going to cover strings in more detail and we're going to fully get to grips 2

with this particular primitive data type. 3

So previously we saw that we can combine strings using the plus sign. 4

And this creates a single string using a special feature of programming called concatenation. 5

Now you have to imagine that you're joining together everything that's inside a quotation mark and ignoring 6

everything else. 7

So "a" + " " + "b" becomes "a b" concatenated into a single string. 8

Now let's try it out in practice. If we head over to Chrome and we open up our Developer Tools and we 9

head over to our Sources and our Snippets, 10

then we can start writing some code inside our index.js. So we can create an alert that says "hello" 11

+ "world". 12

And this, when we run it, will show helloworld with no spaces in between. So we can add the space by either 13

including it inside a string, so a string with a single space, 14

and this would be "hello" " " "world", 15

or we can have it where we have a "hello" + " world", and remember that it's only the parts that are 16

inside the quotation marks that are combined. 17

All right. So this is pretty easy. 18

So I want to set you the challenge of creating a greeting message using variables and alerts. 19

So I want you to start off with two variables. 20

One is a message which is equal to Hello, and the other variable is called name, 21

and you can set it to either your name, or you can set it to whatever the user enters in a prompt. 22

Then I want you to write a single line of code where you can create a pop up or an alert that says something 23

like, that combines or concatenates these two variables into a single string using these two variables 24

rather than simply just typing the string out. 25

So pause the video and complete this quick challenge. 26

All right. 27

So that's pretty easy. 28

All we need to do is to create an alert. 29

We add the message. 30

Then we add some characters in between, so namely it'll be 31

Hello there, 32

and then we add the name that we are going to greet. 33

And finally we close off our alert. 34

Now the important thing here is that you remember to add the spaces between the message and the name 35

variables. 36

You could have done it this way or you could add another string that's simply a space as well. 37

So did you get that right? 38

If not, have a review of this lesson and have a play around with concatenation inside the Chrome Developer 39

Tools. And in the next lesson we're going to cover another cool feature of strings which is how we can 40

quickly find out the number of characters that are contained inside a single string. 41

So for all of that, I'll see you on the next lesson.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.