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
French
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
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
One thing that separates JavaScript
from a lot of programming languages, is that JavaScript is a dynamic
language. What do I mean by dynamic? Well,
we have two types of programming languages. Static languages or
dynamic languages. In static languages, when we declare a
variable, the type of the variable is set and it cannot be changed
in the future. In a dynamic language like JavaScript,
the type of a variable can change at run time. Let's see this
in code. So back in the example from the last lecture we have declared
this name variable, and we have set that to a string, so
the type of name is currently a string, but it can change in the future.
Let's take a look. So here in the console, we can execute some JavaScript
code, we have this type of operator,
and with that we can check the type of a variable. So after that
we add the name of the variable. In this case the name variable
So note that the type of name is a string. So,
if you reassign name to a different value, like a number,
and check it's type,
look, the type is now changed to a number, this is what we call
a dynamic language, so unlike static languages the type of
these variables will be determined at runtime based on the values
that we assigned to them. Now, let's take a look at a few more examples of the type
of operator. And by the way, note that type of is
another reserved keyword, so we cannot have a variable called
type of. So, we can clear the console by
pressing control and L. So now let's take a look at
the type of age, it's a number. Now if we change
age to a floating point number, and I know it doesn't make sense, but
let's just stick to this for example, 30.1,
and then look at type of age, it's still a
number. So in JavaScript, unlike other programming languages
we don't have two kinds of numbers, we don't have floating point numbers
and integers, all numbers are of type number.
Now, let's look at the type of is approved, it's a
boolean as I told you before, what about the first name, let's have a
look. Type of, first name. It's undefined.
And that's funny, because the value of this variable is undefined
but it's type is also undefined. What does this mean?
Well, earlier I told you that we had two categories of types,
we have primitives or value types, and reference types.
In the primitive types category, we have strings, numbers,
booleans undefined and null. So undefined
is actually a type, but it's also a value.
In this example, because we have set first name,
to undefined as a value it's type is also
undefined, okay? But what about selected color.
Let's have a look, so type of selected color.
The type of this variable is an object.
What is an object? That's a topic for the next lecture.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.