All language subtitles for 004 Exploring the Base Types_en

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
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
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
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
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,100 --> 00:00:05,980 Now let's dig deeper into typescript. 2 00:00:05,980 --> 00:00:09,660 And for this, I'll add a new basics.ts file. 3 00:00:09,660 --> 00:00:13,530 In which we'll dive into some core basics you need to know 4 00:00:13,530 --> 00:00:15,220 about typescript. 5 00:00:15,220 --> 00:00:18,810 And for that, I wanna start with the basic types 6 00:00:18,810 --> 00:00:20,810 you can work with in typescript 7 00:00:20,810 --> 00:00:23,190 which you will need all the time. 8 00:00:23,190 --> 00:00:25,940 And that will be our primitives, which we know 9 00:00:25,940 --> 00:00:30,830 from JavaScript, numbers, strings and booleans. 10 00:00:30,830 --> 00:00:35,300 And then of course, we also have more complex types 11 00:00:35,300 --> 00:00:39,280 like arrays or objects, for example. 12 00:00:39,280 --> 00:00:40,540 And then we're there after 13 00:00:40,540 --> 00:00:43,440 we'll also talk about function types, 14 00:00:43,440 --> 00:00:45,890 parameters and much more. 15 00:00:45,890 --> 00:00:49,660 So that's generally what I wanna talk about here. 16 00:00:49,660 --> 00:00:52,693 And let's start with the primitives here. 17 00:00:53,570 --> 00:00:55,580 The primitive values we have 18 00:00:55,580 --> 00:00:59,450 in JavaScript are numbers, strings, booleans 19 00:00:59,450 --> 00:01:02,960 and also a null and undefined and also symbols. 20 00:01:02,960 --> 00:01:04,080 But we can ignore that. 21 00:01:04,080 --> 00:01:07,820 And number, string and boolean as well as null and undefined 22 00:01:07,820 --> 00:01:10,110 are the important ones therefore. 23 00:01:10,110 --> 00:01:13,070 Now if we have a variable, let's say, let's say the age 24 00:01:13,070 --> 00:01:15,660 of a user, and we wanna make it cleater, 25 00:01:15,660 --> 00:01:18,040 that India we wanna have a number. 26 00:01:18,040 --> 00:01:21,330 We can make that clarification with typescript 27 00:01:21,330 --> 00:01:24,570 by adding a colon after the variable name 28 00:01:24,570 --> 00:01:27,157 and then simply specifying the type 29 00:01:27,157 --> 00:01:30,580 of value that should be stored in this variable. 30 00:01:30,580 --> 00:01:34,370 And then we can finish this variable declaration here. 31 00:01:34,370 --> 00:01:38,730 If I then later assign a value, assigning a number is okay 32 00:01:38,730 --> 00:01:43,050 including floats, so numbers with a decimal place 33 00:01:43,050 --> 00:01:46,810 but assigning a string would give me an error. 34 00:01:46,810 --> 00:01:48,160 That's what we saw before 35 00:01:48,160 --> 00:01:50,853 with that function and its parameters as well. 36 00:01:52,280 --> 00:01:55,320 Now, of course, we can also assign a value here right away. 37 00:01:55,320 --> 00:01:58,070 We don't have to have this declaration 38 00:01:58,070 --> 00:01:59,870 without a value assignment. 39 00:01:59,870 --> 00:02:01,163 Both is allowed. 40 00:02:02,880 --> 00:02:05,790 Now we also can of course have a username 41 00:02:05,790 --> 00:02:07,100 which should be a string. 42 00:02:07,100 --> 00:02:09,930 And for that, we can assign a type like this. 43 00:02:09,930 --> 00:02:13,400 String is the type we wanna use here. 44 00:02:13,400 --> 00:02:15,450 And one important note here, 45 00:02:15,450 --> 00:02:19,900 in typescript it's number and string written like this 46 00:02:19,900 --> 00:02:22,530 with lower case starting characters. 47 00:02:22,530 --> 00:02:24,870 It's not number like this. 48 00:02:24,870 --> 00:02:26,960 We don't get an error if we use that 49 00:02:26,960 --> 00:02:31,510 but this actually points at the number object in JavaScript. 50 00:02:31,510 --> 00:02:34,240 We want the number primitive type 51 00:02:34,240 --> 00:02:38,170 which starts with a lowercase N, the same for string. 52 00:02:38,170 --> 00:02:40,110 We want the primitive type, 53 00:02:40,110 --> 00:02:42,820 which starts with a lowercase S 54 00:02:42,820 --> 00:02:45,413 and then of course, here we can assign a value. 55 00:02:46,410 --> 00:02:47,670 And we can also of course 56 00:02:47,670 --> 00:02:52,400 store boolean values like is instructor 57 00:02:53,830 --> 00:02:58,380 and add boolean as a type assignment so that their after, 58 00:02:58,380 --> 00:03:02,230 I may store true or false in that variable. 59 00:03:02,230 --> 00:03:05,520 And these are our core primitive value types 60 00:03:05,520 --> 00:03:08,860 which we can assign, in this case to variables 61 00:03:08,860 --> 00:03:13,400 before we also saw how we set types for function parameters. 62 00:03:13,400 --> 00:03:17,630 And we'll see more places where we can set types 63 00:03:17,630 --> 00:03:19,023 in the next minutes. 64 00:03:20,150 --> 00:03:23,360 Now, as I mentioned, we also have null and undefined 65 00:03:23,360 --> 00:03:28,360 as types, but we don't typically set something to be null. 66 00:03:28,550 --> 00:03:33,550 If I set hobbies to null here, then this would be possible. 67 00:03:35,030 --> 00:03:38,260 But then whenever I try to assign anything, I get an error 68 00:03:38,260 --> 00:03:40,950 which of course is not too useful. 69 00:03:40,950 --> 00:03:42,640 Instead we'll use null 70 00:03:42,640 --> 00:03:45,500 and undefined in a slightly different way 71 00:03:45,500 --> 00:03:47,940 which we'll learn about in a couple of minutes. 72 00:03:47,940 --> 00:03:49,820 So number, strings and booleans, 73 00:03:49,820 --> 00:03:53,583 are the core primitive value types we should be aware of. 5837

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