Interested in Personalized Training with Job Assistance? Know More
INTRODUCTION TO JAVA SCRIPT
Java script features
Hello guys, welcome to our series Java script.
Even the old version web browser supports Java script, except some functionalities. They support Java script but some functions of Java script are not supported by older version. The new functionalities are not supported by older version. But there is no such web browser that does not support Java script.
In Java script, as in C language we use syntax as programming language, almost similar programming things syntax we use in Java script as it is written over here.
If you have any information about C language it’s well and good otherwise no need to worry we are going to learn all those things in Java script. Like how to write it’s syntax? How to Input Code Structure? Mostly we use similar structure of C in Java script.
Java script is known as weakly typed language because it is operation based language, if I load my webpage and during loading if perform any event that is if I my webpage is loading and I am firing some events that will take place. But for running some things in Java script we need few events like On click event, first I need to place a button through HTML and then on click of that button I will fire my event.
So here comes dependency, means I need to be connected with the click of button, if I don’t click button then my operation will not be performed. So Java script is a weakly typed language, which means it is dependent on an operation. Until and unless I click on button, until and unless pages are scrolled, transition is performed till Java script code cannot be run.
Java script is object oriented programming language, we can create object through Java script, and the objects which are inbuilt for example there is window object will also be covered in the course. There is document object, navigator object, so these different object available in java script, with the help of these objects we can make a prototype which can be used. Only the use of classes is not sufficient.
Java script is an object oriented programming language that uses prototypes rather than using classes for inheritance. Means Java or any other programming language are such language in which if we bring class we need make objects in order to use it’s features or you need generate a child class of that particular class.
Child class means a class which will inherit the class’s all the properties and methods. Inheriting means if you are son then the things which you will get from your father for example Property. So this property you are inheriting from your father.
Then there are some features, like there is a son or daughter, his or her behavior way of speaking which resembles their parents. Like some talk like their mother, some talk like their father, walk like mother or some emotions like anger etc. any behavior which a child gets from either of the parent.
Similarly if we are generating class and we have to form a child class means the properties of that class or methods of that class are given to another class then the second class becomes child class of first class. So here all the properties and methods which the child class has taken from it’s parent class is known as Inheritance.so inheriting means taking those things from their parent class.
So the meaning of the given line is Java script is one such object oriented programming language in which you don’t need to take each and everything directly from your parent, there are some default prototypes also.
Prototypes means few basic things are already given for the object which the object have take as it is you don’t need to inherit those. All these things we will learn in as the course advances.
Next is, Java script is light-weighted and interpreted language means executing Java language is easy, when we run a code in one browser we run same code in different browser, no difference occurs over there, we don’t need to add any extra code when we change browser. So it is light weighted and can be easily interpreted.
Yes Java script is case-sensitive language. Meaning if we have defined a variable in capital A then I cannot get the value of that variable by writing small a. I need to write capital A only.
Next is Java script is supportable in several operating systems including windows, macOS, etc. which means as Java is accessible in different web browsers in same way it is accessible in different operating systems.
It provides good control to the users over the web browsers. That means our users can easily use Java script in web browsers. All these are features of Java script. Now let us see where Java scripted can be used. What are it’s applications.
Most important and the first application is that Java script is very useful in Client-side validation.for example if I want add my name in given input field and don’t want numbers to be added in that particular input field because numbers are not part of name. for example if my name is Joel that means four alphabets are used i.e. J O E L, there is no such name where you can find 1 2 3 4. That’s why in input field if you don’t want to add numbers you want to restrict use of numbers, then how will you do it? You will do it though java script means if you need to perform validation somewhere, validation means checking if name is the input field then there will be only alphabets not numbers
If the input field is telephone number than there should mandatorily numbers only not characters. How does all these applications can be performed in web page where I have built in a form? How will I validate that? I can do that with the help of Java script.
Validating in Java script means in our web page client side, means if I am using a web page I am the client, so whatever validation client side needs to perform it can be done through Java script.
Next is dynamic drop down menus. Sometimes, for example, if I choose different countries like India, China, Nepal then every country has different states. So if I select India as country then my next drop down will be of state where based on the previous drop down values my values should come.
If I select India then under state only states of India should appear, if I select China then under state only states of china should appear, if select US then only states of US should appear. So how are these things done? So these are done with the help of Java script, if my drop down has particular value then based on previous drop down value it should be set. This dynamism can be added through Java script.
So the examples which I just gave are not possible with HTML and CSS, for that you need to use Java script only.
Displaying date and time. If I want to show date and time then there is no such format function available in HTML and CSS with help which I can directly add date and time. I can add with the help of Java script.
Displaying pop-up windows and dialog boxes means if I click somewhere with wrong input then I need to show my user a notice that what you have added is wrong. So how is that possible? The notice that appears is called as dialog box or pop up means in existing screen opening a new small screen.
Like alert dialog box, confirm dialog box and prompt dialog box, means giving notice that the input given by you is wrong. How is it done? It is done with the help of Java script.
Displaying clocks, means the time which we have to show up in our web page which are continuously running, how can we do that? Again with the help of Java script.
All these are our applications of Java script. It is not necessary that the applications given over here are the only applications of Java script. Java script has many applications. The above explained are the ones which are quite important. Apart from these there are many features as well as applications of Java script.
Now if we take an example of Java script, that how Java script runs, for that we will open sublime text. For that you can visit the site of sublime text. Sublime text’s current version is 3 so sublime text 3, so this is our sublime text’s site, just go to the site.
When we go to sublime text site there is an option of download given, so we are going to download install our sublime text editor. In our session I will show you how to download an editor. So the first thing to do is go to download from our sublime text then you will see options for downloading like Windows-64 and Windows so we can choose either one. I am choosing the windows option where my sublime text is downloading. Once it is downloaded go to the folder (5 seconds pause) folder is getting loaded ( 3 seconds pause) so here our sublime text can be seen in our folder, now to run it we need to right click and open it and then we have to run it.
As soon as we click on run we can see path, on which path we have to store it, after execution where files will be stored? At the default path, so after clicking next again clicking next click on install. As soon as the installation is done we have to click on finish. So our sublime text will appear on Desktop, so I have closed it and here installation of sublime text is finished so just open sublime text and after clicking on start we can see our sublime text so just click on that.(10 second pause).
As of now we are giving an example name, so now what do I have to add in this program? Here you can see on slide, we are adding simple Java script for that we have to use script tag in which on our page we have simply type something, let us say welcome to LearnVern, so I can write it anywhere, I can write in head tag, I can write in body tag so as an example I am writing here in body tag.
As soon as I wrote script and clicked ctrl space this much portion got generated and appeared. So here I don’t have to type manually in sublime text. Writing Text Java script in type is mandatory. When we use to add CSS then we had text CSS and the tag which we used to add that was style tag.
I have typed style and now I will add ctrl space, now you can see text CSS has been added in type, so in this I can add my CSS. Now I have typed script because Java script is a scripting language. Type script and write here, what did we write? Because we need to type something in our body for that what line did we use? Document, if we need to access anything in the body of our web page we use object document.
So document, as soon as I completed typing document, my document appeared in blue color. Dot write “This is LearnVern”; semicolon is not mandatory but we will do because every programming language’s line’s end is always semicolon. Similarly now (10 seconds pause)
Now this is my program, here it is written ‘This is LearnVern’, how did this appear? We have not written any HTML over here, we have written script, let’s say if I write H1 hello under script then you can see hello in the content which I have added through java script. So hello has been added through html and through script This is LearnVern has been added.
We have covered all these topics in today’s segment. So guys this was our normal introductory part, next topic will be how to run Java script? Which are the different ways available to run Java script? That we will see in next topic.
(Video duration- 17min 46 sec)
(Translation time- 1 hr 45 mins)
Have a friend to whom you would want to share this course?