Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
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.