Transcripts
1. Introduction To JavaScript Course : Welcome everyone to the
complete course of JavaScript. We are going to discuss about the Java script from
basics to Woops concept. In the first module, we are going to discuss about the concepts like variables, data types, array methods, and also we are going
to discuss about IL loops concept in JavaScript. In the second module, we are going to discuss about the object oriented
concept in JavaScript, like inheritance, nhapssen
and polymorphism. So this course is very, very, very useful for the
beginners who are trying to learn Java
script for the first time. So let's get started.
2. Javascript Class 1 : Introduction: Welcome, everyone.
In today's class, we are going to discuss about
introduction to JavaScript. So JavaScript is the most powerful Clin
Side scripting language. It is a scripting language that can be useful for clenSide. Clenside is nothing but user. Also, the JavaScript
can be useful for making the
website interactive. So if you want your
website more response, you have to use JavaScript. So JavaScript is an object based scripting language
that is nothing but object oriented language. Also, JavaScript is a
lightweight and cross platform. And then cross
platform is nothing, but the JavaScript can be run in any platform like
Windows, Mac and Linux. Also, you can see the JavaScript is an interrupted language that executes the code line by line, providing
more flexibility. So this is the introduction
to JavaScript. After that, we are
going to discuss about the advantages of JavaScript. So the first advantage is
client side scripting. So JavaScript runs directly in the user web browser
reducing the load of server. So that's the first advantage. So the second
advantage is nothing, but it is a cross
platform compatibility. So it can run in any platform like Windows, Mac and Linux. So that's the second advantage. So third one is nothing but
increased interactivity. So interactivity is nothing, but if you want your
website more responsive, the JavaScript can be useful. So that's the third advantage. So after that, we are
going to discuss about the disadvantages of JavaScript. So the first is the
security concern. So JavaScript code can be easily maniplatd or changed
by the hacks. So that's the first
disadvantage. And then second one is
browser compatibility issue. So some of the browsers
cannot run the Javascript. So that's the second
disadvantage. And then third disadvantage
is dependency on JavaScript. Some of the website directly
depend on JavaScript. If the user disable
the JavaScript, then the web browser
cannot function properly. So these are all
the disadvantages that we are going
to discuss about. What are all the
applications that can be created using JavaScript. So first is the web development. We can create websites using JavaScript and then
single page applications. So the single page applications
like react angular that can be combined with JavaScript
to create new webpage. Also, you can use JavaScript as server side
scripting language. With the help of node JS, we can use JavaScript
for server side. And the last application
can be mobile development. If you want to create
any mobile applications, you can also use JavaScript using the react native
and the Native script. So these are all the
applications that can be created using JavaScript. So after that, we are
going to discuss about the job opportunities when
you learn JavaScript. So when you learn JavaScript, you can achieve the jobs
like web developer, front end developer,
full stack developer, and also JavaScript engineer. So these are all the
job opportunities when you learn JavaScript.
So that's it, everyone. In today's class, we
will discuss about complete introducti
and do JavaScript. So in the next class, we
are going to discuss about how to run our first
JavaScript program.
3. Javascript Class 2 : Running JS in VSCode: Welcome everyone to
the first class. In today's class, we are
going to discuss about how to run our JavaScript
program in our computer. For running JavaScript
program, there are many ID. You can choose online
editor or offline editor. So we are going to
select offline editor, that is VS code,
Visual Studio code. We are going to run
our JavaScript program in Visual Studio code. For that, you need
to download no JS. For running the JavaScript
program in your VS code, you need to download no JS. So you have to type
no JS download, and then you have to select
the official website. So in that, you have to
select pre built Installer. After that, you need to
select Download option. After the download is completed, you need to open
the Command Prompt. So you have to type
Command Prompt, and then you have to type
node, hyphen hyphen Versan. So you can see our node JS is successfully installed
in our computer. So you have to
create a new folder for your JavaScript program, and then you have to open
the folder with VS code. So after opening the VS code, you need to install
some of the extensions. For that, you need to
open the extension, and then you have
to type JavaScript. So after that, you
have to install the verified extension only. So you need to download
the code snippets and also the
JavaScript extensions. Whatever you want, you
have to install that, but only verified extension. So after the installation
is completed, you need to close your VS code and then restart your VS code. After restarting our VS code, you need to create a new
file, index dot HTML. So we are going to
create two files. The first one is
the index dot HTML, and then the second one
is the J external JSi. So you have to type
your own name. I'm going to type sample dot JS. So that's the format. JS is the extension
for JavaScript. So we are going to use the HHTMLFle before
running our JavaScript, we need to set our HHTMLFle. So in the HTML file, you need to type this code. You have to type HHTMLKlonF. So it will print the
default HTML tags. So you don't need
to type body tag. So it will generate the
default tax for you. So you have to change the title for your JavaScript program, type your own title. I'm going to type
JavaScript tutorial. So after that, inside the body, I'm going to type Hu tie. So that's the heading. I'm
going to type JavaScript. So I have to type
the name, correct. So I'm going to type
JavaScript tutorial. So you need to save you file. After that, you need
to run your code. For running our code, you need to install
the extension. That is Live server. So you need to install
this extenson in VS code. So for that, you need
to type Live server. Live, and then you
have to type server. So after that, you need to install this
extension for running your HTML or any other
web development project. So after installing
the live server, you need to run the code. And then you can
see your output is successfully generated
in the web page. So you can also open like this. But you need to install
live server extension. It will be very, very useful
for running our project. After that, we are going to
discuss about how to run our JavaScript program
in the webpage. For that, we are going
to select two methods. So first, we are going
to use the HH DML file. For that, you need to type the script tag for running
the JavaScript program. So that's the tag
for JavaScript. So you can type the
JavaScript program inside the body tag and
also inside the head tag. First, we are going
to discuss about how to print our
output in the webpage. For that, you need to
type this function. That is document dot right off. Inside that, you need
to tie your string. So I'm going to type Hala world, and then you have to put
semicolon to the statement. So dmandtR will print your
output in the webpage. So that's the use of dmandtR. So in the website, you
can see your output. That's the JavaScript
output Hala world. So this is the first
method for running your JavaScript in the
webpage using HHTML. So after that, we are going
to use the second method. That is, we are going to use the external JavaScript to
run our JavaScript program. For that, you need to link your external JavaScript
program to your HTML file. For that, you need
to type this code. So you need to type script, and then you need to type SRC, SRC is nothing but source. Equality, you need to type your JavaScript file
name that is sample DJs. You need to type correct, and then you need to
close your script tag. So after that, we can easily run our JavaScript program
using the external file. So for running your
JavaScript program, you need to type console
dot log of function. Inside the bracket, you
need to type your string. So you can type hello. And then you need to put
semicolon to the statement. So this is the
syntax for running your JavaScript program
in the console. So after that, you need
to open your web page, and then you need
to right click, and then you need
to select Inspect. So in the Inspect, you need to select Console. You can see the output Hello. So that's our external
JavaScript output. So you can see the file
name sample dot JS. So console dot log is for running your
output in the Console. And then document dot Wright is for running your output
in the web page. So if you want to run
your JavaScript program in the Visual Studio code, you need to download the NodeJS, and then you need
to run the code. So in the terminal, you can see the output
using the node JS. So for that only, you need to download
NodeJS for running a JavaScript program in the terminal or
any other console. So you can see the output
Hello. So that's it, everyone. In today's class, we are
discussed about how to run our JavaScript program
in Visual Studio code.
4. Javascript Class 3 : console log vs Document write: Everyone to the second class. In today's class,
we are going to discuss about the
difference between console dot log and then
dom dot write off function. So we are going to discuss
about the differences. So domandt write is very, very useful for if
you want to print your JavaScript output
in that web page, you need to use
dcmandtttFunction. So first, we are
going to discuss about document dot
write off function. So you can see the output will be presented
in the webpage. So that's the use of
document dot Trita function. After that, we are
going to discuss about console dot LogovFunction. If you want to run your
output in the console, you need to use
console dot LogOv. So you need to type the code, console dot Log Of. It will print the output in the terminal or any other
console in your webpage. So you need to save your file, and then you need to
open your web browser. You can see the
output in Console. So that's the use of
console dot Logo. It will print the
output in the Console. We are going to discuss
about the console dot log of function in the samples,
our external file. So you can choose
Console dot lava f in both external and also
index dot HDMfle. But the document
dot write function cannot be used in
Excel and JSFile. So if you run this code, you can see the output
source the error. The document is not defined. So you need to select
document dot writ for HTML five and
console dot Lav five for both HTML and
also external JS. So these are all the
differences between console dot lava function and also document dot
write a function.
5. Javascript Class 4 : Variables: Everyone to the third class. In today's class, we
are going to discuss about variables in JavaScript. So variables are nothing, but it is a container, which is those that data values. So that's the simple
definition for variables. In Java script, there are three keywords for
creating the variables. So the first tone is the
keyword and then second to is the let keyword and then third
on is the const keyword. So we are going to
discuss that one by one. So the first tone
is the Wakeyword. So Wakeyword is one of the oldest way to create the
variables in JavaScript. Also we can re declare the variables using
the war keyword. And then Tad one is nothing, but it is a global scope. If we create a
variable using the w, it can be used as
global variables. So these are all the
definition for war keyword. And then second one and third is nothing but let
ten const keyword. So it is one of
the newest way for creating the variables
in JavaScript. Also the ten const
or loc tal scope. If we create a variable
using ten cons, it can be perform
as local variables. And then third
definition is nothing, but we cannot re declare the values using the
let turn const keyword. So now we are going to see an example for these variables. First, we are going to create a variable using the keyword. So you need to type
the keyword where, and then you need to
type the variable name equal to value. So where is the keyword, A is the variable name. So that's the variable equal
to ten, ten is the value. So A is a container which
stores the value ten. So in JavaScript, you don't
need to type the data type. It automatically assigns
the variable data type. So it likes the Python. For printing the variable, you can select two methods. The first one is the document
dort or console dot log. You can see the output ten. So this is the way for
printing the variables. So it is one of the oldest way for creating the
variables in JavaScript. So after that, we
are going to discuss about the definition
for redeclare. So if I type where A cult D, so I'm just redeclare the values and then I'm
going to print the output. So you can see that
20 is updated. Using the ware, we can
update the values. So that's the definition
for redeclare. Using the keyword, we can
redeclare the values. And then third one is
nothing but global scope. Using the ware keyword variable, we can use the variable
as global variable. So after that, we are going
to discuss about let keyword. So we are going to create a variable using
the let keyword. So we need to type let,
so that's the keyword, and then you need to
type the variable name equal to, and then value. So X is the variable, and then 20 is the value. Let is one of the newest way for creating the
variables in JavaScript. After that, we are just printing the output using the
console dot log. If I run the code, you
can see the output. So you can see the
two previous output. After that, you can see the
local scope is nothing, but it is a local variable. It cannot be used
as global variable. And then we are going
to discuss about the third definition
that is no redeclare. So if we create a variable
using the let keyword, we cannot redeclare the values. So I'm just trying to
redeclare the value, you can see the error
swing in the output. So I'm just commenting
the previous output. You need to run the code. You can see X has been
already declared. So that's the definition
for no redeclare. We cannot re declare the variables using
then let keyword, but in where you can redeclare. And then we are going
to discuss about the last keyword that is const. So that is nothing but constant. So we need to type the variable. You can type your own variable, printing the output, using the
console dot Lava function. So inside the bracket, you need to type Y. So that's the variable
and then run the code. You can see the output
40. So that's the output. If I try to re
declare the value, you can see the output,
so is the error. So I'm going to type
host Y equal to 60. You can see the error message. So Y has been
already redeclared. So that's the concept
of where let and const. So variables is
nothing but it is a container which
is throws the data.
6. Javascript Class 5 : Datatypes: Welcome, everyone.
In today's class, we're going to discuss about
data types in JavaScript. So there are many data types. So first one is the
integer data type, second one is the
float data type, third one is the
character data type, fourth one is the
string data type, and then last one is
the Boolean data type. So we are going to discuss about the data types one by one. First, you need to type
the keyword that is where, and then you need to type the variable name
and then value. So the first to is the
integer data type. So in JavaScript, you don't
need to type the data type. It will automatically assigns
the data type like Python. So after that, we
are going to create the second data type
that is float data type. So we need to time
being equal to 20.4. So it is considered
as float data type. And then we are going to create the third data type that
is character data type. So you need to type
single quotation, so that will be considered
as character data type. Then we are going to create the fourth data type that
is string data type. So you need to type where is
equal to double quotation, and then you need to type the
string that is Hala world. So it will be considered
as string data type. After that, we are going to create
our last data type that is Boolean data type. So boolean is nothing
but true or false. So I'm going to type true. So it is considered
as Boolean data type. If you want to print
all the data types, you can choose the two methods. The first one is the
doc dot write off or the second down is
the console dot log off. You can select any one of them. So I'm going to type
console dot log off. Inside that, I'm going
to type the variable A. So that's the integer data type. So you can see the output. Ten, ten is an
integer data type. After that, I'm going
to change to X, so X is nothing but
boolean data type. That is true. I'm going
to type another value, that is, is considered
a string data type, and also you can see
the output color world. So if you want to find the
data type of the variable, you can select the
function that is type of. So it will find the data
type of your variable. So you need to type type off and then you need to
type the variable name. And then you need to run this
code. You can see string. So that's the use of
type of function. It will find your data type. You can see the
Boolean data type. So that's it, everyone.
In today's class, we discuss about data
types in JavaScript.
7. Javascript Class 6 : Arithmetic Operator: Welcome, everyone.
In today's class, we are going to discuss about
operators in JavaScript. There are many operators
in JavaScript. So the first we are going to discuss about
arithmetic operator. So arithmetic operator is
nothing but Addison subaction, multiplation, division, modulus,
increment and decrement. We are going to discuss about the arithmetic
operators one by one. First, you need to
create the variable, let Aaltic ten, and then I'm
going to type et Bali 20. You can type your own values. And then I'm going to
print the output using the console dot log of A plus B. So that's the Addison
arithmetic operator plus an arithmetic addition. So I'm going to print five
times minus A minus B, A and B, A divided
B, a modulo B. So in division, it will print
the quotient as an output. In modulus, it will print
reminder as an output. Atlas, I'm going to use the
increment and decrement. So if I run this code,
you can see the output. So I'm just clearing the
screen and then output, 15 Addison, A plus B, and then five is for subaction then 50 is for multiclation, and then two is
for the division. So that's the quotient, and then zero is the
remainder for modulus, and ten is for the
arithmetic increment. So you need to know
about the differences between post increment
and pre increment. In post increment, the
value of A will be printed. At last, you can see the
output for post decrement. So the value is lawn. Before that, A plus plus, the output will use ten. But after the line is
incremented, A becomes lawn. So that's the output
for A minus minus. That is a post decrement. So these are all the arithmetic
operators in JavaScript.
8. Javascript Class 7 : Logical Operator: Everyone, in today's class, we are going to discuss about logical operators in JavaScript. So there are three logical
operators and are not. So we are going to discuss about a logical operator one by one. So for that, I just created two variables A equal to
ten and B equal to five. After that, I'm going to print the logical operator one by one. For that, I'm going to
type console dot log of a greater than B, you need to type two condition, A greater than B
and A less than B. So and is the symbol
for unlogical operator. For logical operator, the
both condition must be true. Then only the
output source true. If any one of the condition
is not true or not satisfied, then the output will so false. So the first condition
is a greater than B. We know that A equal to
ten and B equal to five, the condition is satisfied. The first condition
is satisfied. And the second condition
is A less than B. The condition is not satisfied. So the output will so false. So that's the concept of and. Both condition must be true. If any one of the
condition is false, then the output will be false. So after that, we are going
to discuss about R for that, I'm going to print
console dot log of A, greater than B, second
condition, A less than B. So in our logical operator, any one condition must
be satisfied or true. Then the output will so true. If both condition
does not satisfy, then the output will so false. So the first condition
is a greater than B. We know that A is
greater than B. The condition is satisfied, then the output will so true. So that's the first
output false. And then true is for
the second output. So that's the concept of R, anyone must be true. At lass, we are going to
discuss about naught, so we need to print
console dot log of. I'm going to type the first
condition A greater than B, and then you need to type
the second condition. A less than B. So naught is nothing but it
will reverse the output. So if the operator sows
true in the output, naught will so false
in the output. So that's the concept of naught. It will reverse the output. True becomes false,
false becomes true. And also, you need to type the operator before
the condition. Then only naught
will be present. So these are the condition. We know that this
output will so falls, but naught will
reverse the output. So I'm going to run this code. So you can see that the
first output source falls, but our second
output source proof because of naught naught
will reverse the output. True becomes false,
false becomes true. So that's the concept
of logical operators.
9. Javascript Class 8 : Ternary Operator: Welcome, everyone.
In today's class, we are going to discuss about ternary operator in JavaScript. For that you need to know
about the syntax, first, you need to type
the conditon and then you need to
type the expression. You can type your own expresson. Whether it can be one or
two or three or four, you can type your
own expressons. Based on the condition
satisfaction, the expresson will be
generated in the output. So for the ternary operator, I'm going to type
three variables, A equal to ten, B, qualify and C will
be the condition. So if the condition
is A greater than B, then I'm going to
type to expression. So you need to type Costin mark, and then you need to type
the expression one and two. So the first expression
is nothing but A is greater than B or A is greater. And then you need to type colon, and then you need to type
the second expression. That is B is greater. And then you need to
type the semicolon. After that, you need
to print the output, so that's the C. So, terniaryoperator
is nothing, but it will generate the output
based on the condition. So we know that A
is greater than B. So then the first expression will be printed in the output. So you can see, A is
greater. So that's it guys. In today's class we
are discussed about terniary operator in JavaScript.
10. Javascript Class 9 : If Else: Welcome, everyone.
In today's class, we are going to discuss
about I fels in JavaScript. So it is like a
conditional statements. So for that, we are going to
see an example for I Fels. First, we are going to
create the variables. So I'm going to type A equal
to ten and B equal to 30. And then you need to
type the keyword. That is, if inside that you
need to type the condition. So based on the condition, the block will be generated. So I'm going to type
console dot Log of A is greater than B. And then you need to type the s so we are going to print console dot log of A
is smaller than B. Also, if you want to
create more condition, you need to type
sf in JavaScript. So you need to type sf, and then you need to type
the condition A equal to B. So I'm going to print
console dot log off, A is equal to B. If any one of the
condition is satisfied, then the code will be executed. So we know that A
is less than B, then the s condition will
be generated in the output. You can see A is smaller than
B. So that's the output. If I change the output to 30, then we know that
A is equal to B, then if condition
will be executed. If I change to 50, we know that A is
greater than B, then the first I
will be executed. A is greater than B. So based on the condition, the code will be executed. So that's the definition
and concept of Ils.
11. Javascript Class 10 : While Loop: Welcome, everyone.
In today's class, we're going to discuss
about loops in JavaScript. So first, we are going to
discuss about wild loop. So loops are very,
very important. If I want to print Hello World
for more than ten times, I'm going to print
console dot log of Hello World for
more than ten times. For this problem, the loops are introduced in the
programming languages. So loops are based
on some condition. If the condition is satisfied, then the code will be executed. So for that, we are going to see an example using the y loop, I'm going to print halo world for ten times using the loop. First, you need to initialize
the I rating value. You need to type where
I equal to zero or one. You can type your own value. I'm going to type one. You can type your
own starting value. And then you need
to type the string. I'm going to print halo
world for ten times. For that, I'm going to type
s equal to Hala world. And then you need to
type the keyword that is il after that, inside the bracket, you
need to type the condition. So condition is very, very important in loops. I'm going to type I less
than or equal to ten. That is nothing but I'm going to print a world for ten times. If you type zero, you need to type
I less than ten. If you type I equal to one, you need to type I less
than equal to ten. So that's the difference 0-1. So the condition is nothing
but I stern are equal to ten. I value is nothing but one
stern are equal to ten. The condition is satisfied. Then the code will be
executed using the Y loop. So code is nothing
but our hala world. So for printing the hala world, you need to type
console dot log. Of, you need to type
the variable that is. So will print the hala world. In ten times. And also, we need to increment
the I value. Then only your Hala world
will be printed ten times. So you need to type I plus plus. I plus plus is nothing
but post increment. So you can see the condition, I less than are equal to ten. So the starting value of
I is nothing but one. Then the I value incremented
one by one up to ten. Also, the ten will be satisfied because ten less
than are equal to ten. The condition is satisfied, then the halo l will be printed ten times using the I plus plus. After that, the ten will
be incremented to an. When the value becomes lawn, the condition is not satisfied because I less than
are equal to ten. The condition is not satisfied, then the loop will be exit. So that's the concept of loops
in programming languages. Based on the condition
satisfaction, the loop will be executed. You can see the output
halo world in ten times. Halo wold one, two, three, four, five, six, seven, eight, nine, ten, ten times
my halo world is printed. So this is how you can use
Wild Look in JavaScript. So that's the syntax.
12. Javascript Class 11 : For Loop: Welcome, everyone.
In today's class, we are going to discuss about
far loop in Java script. So previous class we
discussed about Y loop. Now we are going to
discuss about far loop. For example, I'm going to print Hala world for ten times
using the far loop. For that, I'm going to
use the index dot HTML. Inside that you need
to create a script, and then you need to type the variable that
is the Hala world, and then you need to
type the keyword that is far and then you need to
type the starting value, I equal to zero, that's the starting value. And then I less than
are equal to ten. That's the condition. I plus plus is nothing but
incrementing the value. So this is the syntax for creating the for
loop in JavaScript. So I equal to zero, that's the starting, I less
than are equal to ten. That's the conditon I plus
plus, that's the increment. So after that, I'm
going to print hello world using document
dot right function. So you need to type. So you need to type document dot right, will contain the Hala world. And then you need to type plus BR VR is nothing but break tag. So it will print the
output one by one. If you don't type BR, it will print the
output in one line. So that's why we are
using the break tag. So in the browser, you
can see the output, halo world is printed ten times. Based on the condition, the halo world is
printed ten times. So if I delete the
BR and run the code, you can see the
output in one line. So that's why we
need to use BR tag. Also, you can run
your far loop in the external JavaScript
using the console dot log. So it is your own choice.
13. Javascript Class 12 : Break & Continue: Welcome, everyone.
In today's class, we are going to discuss
about break and continue statement
in JavaScript. Break will exit the loop. Continue will tip the
particular value in the loop. So that's the concept
of break and continue. For that, we are going to see an example using the far lo. So for that, I'm going to
type where I equal to zero. So that's the starting value. And then you need to
type the four loop. So I'm going to type I, and then I less ten
are equal to ten. That's the condition,
and then I plus plus. So that's the
incrementing value. So you don't need to type the Data Type and then you
need to type the condition. If the value of I becomes
five or four or three, we need to break the loop. So that's the use
of break condition. And then you need to print
the output Consulta log off. You need to print I. It will print the I
values one by one. When the I value becomes Pi, it will break the loop. So you can see the output zero, one, two, three, four. When the I value becomes five, the loop Pi exit using
the break keyword. So that's the concept of break. It will exit the loop when
the condition is satisfied. So if I type seven and
then run the code again, you can see the
output up to six, the value is printed. When the I becomes seven, the loop pis exit. After that, we are going
to discuss about continue. So if I type continue, it will particularly
skip the value. That is, it will skip the seven. You can see the
output zero to nian. But when the value
of I becomes seven, that value will be
skipped in the output. So you can see five and six, and then eight nan
seven is not printed. If I type two and then
run the code again, you can see zero, one, three, four, five,
six, seven, 89. The two is skip. So that's the concept
of break can continue. Break will exit the loop, continue will skip
the particular value.
14. Javascript Class 13 : Array: Welcome everyone.
In today's class, we are going to discuss
about RA in JavaScript. So RA is nothing, but it
contains the similar data types. But in JavaScript, you can use both similar and also dissimilar
data types in one array. So we are going
to see an example how to create array
in JavaScript. For that, you need to
use the const keyword. And then you need to type
the array name equal to, and then you need to
type the bracket. Inside the bracket, you
need to type the values. You can type integer
array or string array, have to create your own array. I'm going to create
string array, hello world, and
then JavaScript. So this is nothing but
string data type array. So this is the syntax
for creating the array. And then I'm going to
create the second array that will be considered
as integer array. I'm going to type ten to the 30. So it is nothing
but integer array. So if I want to print the
arrays, you have to use. So before that, you need to know about the concept of index. So array is based on
the index position. So the index starts from zero and then goes to
the element value. So index starts from zero, one, two, three,
and then goes on. Hello is the 03 index. And then world is
the first index. JavaScript is the second index, ten, 20, 30, zero, one, two, so if you want to
print the array values, you need to use the index. So if I want to
print JavaScript, it is the second
index for that I'm going to use console
dot, Log off. So you need to type console dot, Log off, A off. You need to type
A square bracket, and then you need to
type the index position. That is two and
then run the code. You can see the
output Java script. So that's the concept
of index position. If you want to print the
element in the array, you need to use index. So you need to type B, so that's the int data
type array variable. So if I run the code, you
can see the output 20. So 20 is nothing
but first index. So if you want to
print all the values, you need to use the
concept of loops. You can use for each
loop or far loop. Based on your own choice, you can choose any one of them. First, we are going
to discuss about the far loop for
printing all the values. For that, you need to type four, and then you need to
type the starting value, that is I equal to zero, and then you need to
type the condition. So the condition is I
less than a dot length. You need to use the length function for
printing the output. For that, you need to
type a dot length. And then you need to
print the output using the console dot log of A of I. It will print the
output one by one. First, you need to type the
starting value and then you need to type the
condition A dt length. It will generate the length, and then you need to
type the increment. That is I plus plus. After that, you need
to run the code. You can see the output,
hello world, JavaScript. These are all the output. So I'm going to comment
the previous output and then run the code. You can see, hello,
world, JavaScript. So these are all the elements present in the string array. So if I want to print B, you need to change the
value B dot length, and B of I. It will print all
elements one by one. You can see ten, 20, 30, so this is how you can print the
output of your array. So after that, we are going to discuss about array methods. First, we are going
to discuss about how to add the element using puss. For that you need to
type B dot push off. So you can type your element. I'm going to type thousand. And then I'm going to
print the output using the console dot log of B. It will print the output. So you can see the output. Ten, 20, 30, 1,000. New element will
be added at last. After that, if you want
to delete any element, you can choose pop method.
So I'm going to type. Instead of push, I'm going
to type B dt pop off. It will delete the element. Ten and 20, 30 will be
deleted from our output. So after that, we
are going to discuss about the third
method that is SAT. I'm going to create a new array with ascending
and also descending values. And then I'm going to run the code using the SAT function. You can see ten, 20, 30, 50, 70. So our elements are based
on the ascending order. So after that, we are
going to discuss about the fourth method
that is reverse. So reverse will
reverse the output. So 30 will comes first, and then 2010, 70, and 50. It will reverse the
output. And then length. So length is nothing but it
will print the length of your array. That is five. So five elements are
present in our array. So after that, we are
going to discuss about the lost method that is concat. So I'm going to
concat two array. So I'm going to create
a new array that is where C equal to
square bracket, 23 45. So that's the integer array. So I'm going to
concat two arrays. I'm going to concat
integer array first. So I'm going to
type where D equal, B, concat of C. So if I run this code using the console dot log you
can see the output source, the concatenation of two array. As you can concatenate
string and also integer. So I'm going to change
the value at concat of C, and then I'm going
to run the code. So you can see the
output, hello, world, JavaScript, 23, and 45. So string and integer are concatenated. So that's it guys. In today's class,
we are discussed about array in JavaScript, and also we are discussed
about basic methods in array.
15. Javascript Class 14 : DOM Access: Welcome, everyone.
In today's class, we are going to discuss about
the differences between get element by ID and then
get element by tag name. For that first, we
are going to create a paragraph inside
the paragraph, we just created the ID. So ID is nothing but sample. You need to type script so that's the keyword for
creating the JavaScript. And then you need to type the code for
printing the output. That is document dot, and then you need to access
the paragraph using the ID. For that, you need to type document dot get element by ID. Inside the quotation,
you need to type the ID name.
That is sample. So you need to type sample. So we are just accessing
the paragraph using the ID, and then you need to
type inner dot HTML. So inner HTML is nothing but the output will be printed
inside the paragraph. So you need to type
the paragraph. You can type your own sentence. So paragraph using JavaScript. So we're just accessing the
paragraph using the ID. So you can see the output
paragraph using JavaScript. So that's the use of
get element by ID. We can access the
tag using the ID. Inner HDML is nothing, but we are going to print the output inside the paragraph. So after that, we are going
to say and second example, I'm going to create
ID for the headdin. So I'm going to create
headdin. So that's the ID. So I'm going to change the
JavaScript tutorial text to another text using
the get element by ID. So you need to type the
ID name that is heading. Inside the quotation,
you need to type. And then you need to type dt inner HTML for printing the
output inside the H one, and then I'm going
to change the text. It will override
the previous text. So you can see extra text. So that's our overrided text. So get element by ID is
very, very useful for. If you want to access the HTML
elements using JavaScript, you can use get element by ID. So after that, we
are going to discuss about get element by tag name. For that, we are going
to see an example. You need to type get
element by tag name, document dot get
element by tag name. So you need to
type the tag name. So tag name is nothing
but paragraph. You need to type P. So
that's the tag name. You need to type the index, so that's the zeroth
index, innerHTML. Or printing the output
inside the paragraph, and then you need to
type the paragraph. You can type your home sentence. So you can see the output
paragraph using Js. So that's the output using
the get element by tag name. Second example has
one, that's the tag. And then I want to type
head in using JavaScript. After that, I'm going
to open the browser. You can see the output
heading using JS. So this is how you can access the HTML elements using
JavaScript by two types. First one is the ID, and then second one
is the tag name.
16. Javascript Class 15 : Window Objects: Welcome everyone.
In today's class, we are going to discuss about Window object in JavaScript. So there are four methods of
Window object in JavaScript. So the first one is
the Alert message, and then second is the conform and then third one
is the prompt, and then fourth one is the open. First, we are going to
discuss about Alert, how to create lot in both external JS and
also index dot HTML. For external JS, you need to
type Window dot Alert off. Inside that, you need to
type your string or message. So I'm going to type hello. So if I open the browser, we can see that default hello
alert message is generated. So it will be generated
whenever you load the browser. After that, we are going
to discuss about how to create Window offset in HTML. For that, you need to type
the code input type equal to. We just created the
type for button, and then you need to type
the value for the input. So I'm going to
type value button, and then you need to type the
function that is on click. When you click the button, the function will be generated. So you need to type
on click equal t. We need to type
the function name. So you can type your
own function name. I'm going to type message off. So after that, I'm going to type the JavaScript code
inside the script tank. So I'm going to
type the functon. You need to type the
function, that's the keyword, and then you need
to type the name of the function that
is message off. And then you need to
type the message. So we are going to create the alert message for
that you need to type Window dot lot of you
can type your message. I'm going to type one
message that is JavaScript. And then you need
to type semicolon. So this is how you
can type the message. You can select two methods. You can use default
or fungon method. So when you click the button, the message will be generated. That is the alert message using
the window dot Alert off. So you have to open the browser. If I click the button, you can see the output, the alert message is generated. That is JavaScript. So our alert message
is JavaScript. So this is how you can
create the message. So first, we have
completed the Alert. So after that, we are
going to discuss about a second method that is conform. So you need to type window
dot conform of yes or no. You can type your
own confirm message. So you can see the
confirm message. Okay and cancel. There
are two options. Okay for, cancel for no. So that's the default
confirm message. For Lot, you can see the only
one option that is okay. So that's the difference
between allot and conform. Confirm will sew two opson, Alot will sew only one option. So whenever you
load the browser, the default allot and confirm
will sew in the webpage. So after that, we
are going to use the conform in the
index dot HTML. You need to type window
dot conform off. And then you can type
your own confirm message. I just changes the output, and then I'm going to
command the previous output. So you need to open the browser. If I click the button, it will saw the confirm
message, yes or no. So after that, we are going
to discuss about prompt. So that's the third method. So prompt is very,
very useful for if you want to get
any input value, you have to use prompt. So we are going to create the default prompt that
is window dot prompt off. So you can type your
own prompt value. What is your name? So and then I'm going to
open the browser. You can see the prompt.
You can type your name. I'm going to type my name Arun. So that's the default prompt. So after that, we are
going to discuss about how to run the prompt in
the index dot HTML. So I'm going to
create the button, and then I'm going to type
the funks and inside that, I'm going to type
window dot prompt off. So you can type your
own prompt, name. I'm going to type your name. So when I click the button, you can see the prompt name. You can type your name. So this is the
concept of prompt. So after that, we are
going to discuss about the last window object
method that is open. So open is nothing, but it
will open any other website. You have to type the
URL of the website. So we are going to use the
open in the index dot HTML. You have to change
the window dot prompt to window dot open. So inside the quotation, you need to type the URL, you can type your own URL, and then you have
to save the file, and then you have to
click the button. You can see the
website is loaded. Using the window dot open, we can open any other website. So that's the use
of window dot open. Also, you can run
your function in the external JS file because we are just linked
our file with the HHDML. So you need to
copy the function, and then you need to
paste the function inside the external JS file. Both are same. So
that's it, guys. In today's class, we
are discussed about window object method
in JavaScript. So there are four
Window object method, alert, conform,
prompt, and open.
17. Javascript Class 16 : Exception Handling: Welcome, everyone.
In today's class, we are going to
discuss about excepts and handling in JavaScript. So there are three
excepts and hands. Try cats and finally. For example, I'm going
to create two variables, let A Kultuten and let B t zero. So if I try to
divide the values, the output will so on error because it's
zero division error. So try is for it
will try the output. Cat is for it will
print the error, and finally isp it will
not consider the error. I will print the default output. So we are going to
run our code inside the try and then you
need to create cat. So cat is for
finding the errors. ER, ERR is nothing but error. Inside the curly brackets, you need to print the error. So we are going to
print console dot log of Err. That's the error. So after that, you need
to type the finally. So finally is nothing
but default output. It does not consider
about the error, it will print the default value. You need to type
console dot Lagov. You can type your own output. Default answer. After that, you can see the output, infinity
and then default answer. Infinity is nothing
but the error, and then default answer is
nothing but our final output. So that's it, guys.
In today's class, we are discussed about tricTEps
18. Javascript Class 17 : Class & Object: Hi, everyone, now we are
going to discuss about object oriented
concept in JavaScript. First, we are going to
discuss about how to create class and
object in JavaScript. For creating the class, you need to type the class
keyword and then you need to type the file
name as your class. I'm going to type sample, and then you need to
type the Carl bracket. So that's the syntax for creating the class
in JavaScript. So inside that, you have
to type your variables. So I'm going to type A equal to ten and then B equal to 20. So we can create the
variables inside the class. You cannot type W
let are constant. So if I type W C equal
to any other value, you can see the error message. So we cannot type W let or
constant inside the class. Only you can type A, Culotan B quatutan
or C equal to 30. This is how we can create the
variables inside the class. After that, we are going
to create a constructor. So for constructor, you don't need to type the
name of the class. So you'll need to type the
keyword constructor off, and then you need to
type the curly brackets. So this is how you can
create a constructor. So you don't need to
tie the class name. So if you want to access
the values of the class, you need to create this keyword. So you need to tie this keyword for accessing the
class variables. So I'm just created
the new variable D. Using the constructor, you can also assign the value. For assigning the value, you need to type this
dot D equal to 100. So this is how you can assign the value for the class
using the constructor. So you need to remember
this keyword for accessing the variables
of your class. If you don't type this, the error will be
shown in the output. After that, if you want to
print the class variables, you need to type this keyword. So you need to type this dot A. And then you need to type
console dot log of this dot B. And then you need to type the console dot
log of this dot C. And then you need to type
console dot log of this dot D. So this is how you can access the
values using this keyword. First, you need to
type the class keyword and then you need to type
the name of the class. It will be considered
as the file name. And then this is how you
can create the variables. You don't have to
type let or constant. It will sew the error message. So after that, we just
created the constructor. You don't need to
type the class name. If you want to access
the class variable, you need to use this keyword. Also, you can assign the
values using this keyword. If you want to print
the variables also, you need to use
this keyword, TA, this B, this C, and this D. After that, we are going to
discuss about how to create object for our class. For that, you need to type
let OB equal to u sample off. So this is how you
can create object. OB is the object, NU will create the object, and then sample is nothing but our class name off is nothing but our
default constructor. It will call the constructor. Inside the constructor, we
are just printing the output. So after that, you
need to run the code. So you can see the output, ten, 20, 30, and 100. Ten is the A variable, B, 20, C, 30, and 100 is
the D variable. So that's it, guys, we just created class and
object in JavaScript.
19. Javascript Class 18 : Method: Welcome, everyone.
In today's class, we are going to
discuss about how to create methods in class. For that, we are going
to see an example how to create class
method in JavaScript. First, you need to create the class keyword for
creating the class, and then you need to type the
file name as a class name. Sample is our file name. And then you have to
type A equal to ten. That's the value. And then we are going to create a method. So you can type your
method, display. I'm going to type display of
using the curly brackets. Inside the curly brackets, we are going to type our code. So I'm just going to print
the output using the console, and then you need to
type this keyword for accessing the
class variable. So you need to type this dot A. So if you want to access
the class variables, you need to type this keyword. So this is how you can
create method in class. After that, you have
to create object. So you need to type let
OB equal to u sample off. So using the object, we can call our method
for that you need to type OB dot display off. So it will print the
output that is A equal to ten as an output. So if I run this code, you can see the output ten. So if I don't type this keyword
and try to run the code, you can see the error message. That is a is not defined. But when you create
variable inside the method, you don't need to
type this keyword. If you try to access
the class variable, then only you need to
type this keyword. So for that, I'm going
to solve an example. You need to t where
B equal to 20. Inside that display method, you can type where
or let or const. Also, you have to
print the output B. You don't need to
type this keyword. Only if you want to access
the class variable. So if I run this code, you can see the
output ten and 20. So ten is the class variable and 20 is the display
method variable. Also, if I remove R and
try to run the code, you can see the error message. B is not defined, so you need to know
about the syntax of creating the variables
inside the class.
20. Javascript Class 19 : Inheritance: Welcome, everyone.
In today's class, we're going to discuss about
inheritance in Java script. So inheritance is nothing but child class will inherit the
parent class properties. So the properties can be the parent class method,
variables or constructor. So there are many types of
inheritance in Woops concept, but in our today's class, we are going to discuss
about one method that is single inheritance. For single inheritance, first, you need to create
the parent class. So you need to
type class sample. So that's the parent class. So inside the parent class, we are going to
create a constructor. So you need to type constructor, that's the keyword, and
then you need to type off. And then you need to
type the curly brackets. Inside the constructor,
we are going to create variables for creating
the variables, you need to type
this A equal to ten. So we are just created
A equal to ten. And then I'm going to
print the value of A equal to ten using the
console dot log of function. You need to type this dot A. After that I'm going to create the second class that
is the child class. This class will inherit the parent class using
the extend keyword. So you need to type extents, and then you need to type
the parent BAS name. So CAS chit extensa sample
is nothing but parent PAS. So that's the concept
of inheritance. For inheritance, you need
to type extens keyword. So sample is nothing
but the parent glass. So inside the child glass, I'm going to create constructor. So if you want to access the parent class constructor using the child
class constructor, you need to type super keyword. So you need to type super off. It will access the parent
class constructor. So that's the usage
of super off. It will access the parent
class constructor. After that, we are
going to create object for the child class. You need to type ect
object equal to Nu, and then you need to type
the child class name. So child off. I will create the object
for the child class. Using the object of
the child class, we can access the parent class. We can access the
parent class methods, variables, constructor. Also, you can access the Chi glass methods,
variables and constructor. So that's the concept
of inheritance. So if I run this code,
you can see the output, ten is nothing but the
constructor value A equal to ten. So using the super of keyword, we can access the pair
and class constructor. You can also type
where A equal to ten, and also you can type A. And then you can
also run the code. The output will be same. If we want to access the parent class variables
inside the constructor, you need to type this A. So after that, we are going to discuss about how to access the parent class method
using the child class. For that, I'm going to
create a new method that is display inside that I'm going to type console dot log
of parent class. And then also I'm going to create method for
the child class. So after that, I'm going
to print the output. So tens will inherit
all the properties. So after that, I'm going
to call the method of the parent glass using
the child glass object. So I'm going to type
object dot display off and then Objectt
child method off. Using that object, we
can run our output. You can see parent glass
and then child glass. So this is how you can access the parent class method
using the child glass. So that's it, guys.
In today's class, we discussed about single
inheritance in Java script. So inheritance is nothing but the child's class will inherit the parent plus properties. So the properties can be method, variables
or constructor.
21. Javascript Class 20 : Polymorphism: Welcome everyone.
In today's class, we are going to discuss about
polymorphism in JavaScript. So there are two types, method overriding and
method overloading. First, we are going to discuss
about method overriding. Method overriding is nothing but both parent class method and also child class
method will be same. But when you create the object, you can override the method. So that's the concept
of method overriding. For that, we are going
to see an example. First, you need to
create parent class. I'm going to type
class sample off. Inside the parent class, I'm going to create the
method display off. And then I'm going to type
console dot, Log off. You can type your own value. I'm going to type
parents method. So after that, I'm
going to create child class for that
you need to type class, and then you need to type
the child class name. I'm going to type child. And then you need to
type extens keyword, and then you need to type
parent class name, sample off. You need to type
the curly brackets. And then I'm going to create the same method
that is display of. Both parent class method and also child class
method are same. So that's the concept
of method overriding. So this and this same method. And then I'm going
to create object. Based on the object, we can override the method. For that, first, you need
to create the object. I'm going to create object
for the child class. I need to type NU of child, Nu will create the object. So I'm going to create
child class object. Using that object, we
can call our output. Object dot display off. This display of method
will so the output for child class method because we just created object
for child class. So if I run this code, you can see the
output child method. Based on the object, we can override the method. So if you want to print
the parent class method, you need to create
another object. So you need to create
another object. You have to type let O
V equltive new sample of we just created another
object for our parent class. Then only our output will be
shown for the parent class. So using the parent
class object, I'm just calling the method. So if I run this code, you can see the
output parent method. So that's the first,
and then second, that is child method. So that's it, guys.
In today's class, we just discussed about
method overriding. So method overhead
is nothing but both parent class method and also child class
method are same. When you create the object, you can override the method.
22. Javascript Class 21 : Encapsulation: Welcome everyone,
in today's class, we are going to discuss about encapsulation
in JavaScript. Encapsulation is based on the concept of
access specifiers. So there are many
access specifier, but we are going to discuss
about public and private. So public is nothing
but everyone can access our variable method or
constructor or class. But in private,
only specified can be accessed method,
class, or variable. So we are going to
see an example. First, we are going
to create a class. So we need to type class sample, that's the file name, and then we are going to
create public variable first. Eight. So you need to
type A equal to ten. So that's the bublic variable. After that, we are going to
create private variable. For private variable,
you need to type a symbol as B equal to 20, it will be considered
as private variable. A equal to ten is a bublic as B equal to 20 is
nothing but private. A can be accessed by everyone, but B cannot be
accessed by everyone. So after that, I'm
going to create method. For my class, I'm
going to type display. So I'm going to type
display of Inside that, if you want to access the
variables of your class, you need to type this keyword, this dot A, and then this dot B. So if you want to access
the private variable, you need to type a symbol. And then we are going to
print the output using the console dot log of A for printing that you
need to type this dot A. Also, we are going to print the private variable
using this dot B. So if you remove
the hash symbol, we cannot access the
private variable. So then we are going to create
an object for our class. Let OB equal to new sample
of sing that object, we are going to call our method. You are going to call
b dot display off. So if I run this code, so you can see the output
ten and undefined because we cannot access the
private variable without using the has symbol. So you have to type has B. And then you need to
type this dot has B. After that, only you
can print the output. You can see ten and 20. So hapsolation is based
on the access specifier. There are two
public and private. For creating the public, you need to type A equal to ten, for creating the private, you need to type
has B equal type.