Introduction to Javascript for Web Development

I will give you a brief introduction to JavaScript is one of the most popular languages in web development. Today it is regularly used to build large complex applications it allows you to manipulate the contents of your web page.

After it has loaded you can write JavaScript for HTML forms that you create in your website javascript can also be used to create full-blown UI like in desktop applications.  There are limitless possibilities with JavaScript in the post still now in our site.

 

You have learnt about web designing using HTML and CSS now if you want to move a step ahead into becoming a better web developer. It’s better that you learn at least the basics of JavaScript, can make your website interactive it can give live to your website now let me explain to you some of the major advantages of javascript.

Is pretty easy to learn it has simple English like syntax and it can be learnt even by a beginner in programming another important advantage is that it is fast because it executes using browser and does not need to contact the server to do its operations.

The browser executes all the code by it self some of the popular libraries have JavaScript as a foundation jQuery which is one of the most popular libraries in web development is built on JavaScript.

It can make your life easier when you work with these libraries it can take the full advantage of these libraries there are also many frameworks like nor JS

angularjs whose foundation is JavaScript.      So the web developer it is important that you learn at least the basics of javascript.

Uses event-driven model of execution which means that your javascript code will not run until the event it is associated with is triggered there are different events in JavaScript which include loading the page leaving.

The page clicking a button scrolling up or down etc you may have seen pop-ups in most of the modern web sites they are created using javascript.

 

Now let me give you a quick demo of writing a simple code in JavaScript you can write code in your HTML document it self.

 

 

<!DOCTYPE html>
<html lang=”en” dir=”ltr”>
<head>
<meta charset=”utf-8″>
<title>Introduction to Javascript</title>
</head>
<body>

<script type=”text/Javascript”>

var name;
name = prompt(“what is your name ?”);
document.write (“Welcome, ” + name);

</script>

</body>
</html>

 

 

I have created this HTML file called index dot HTML we will write our basic HTML structure give it a title called introduction to JavaScript. Now there are two different places where you can write your JavaScript code you can write it in your head tag or you can write it in your body tag. So it is better to write it in your body tag because of some performance reasons in our body tag at the end of our body tag.

 

 

 

 

 

I am going to write the tag called script tag is used to embed your JavaScript code in

your HTML so in script I will type and text JavaScript here we will write our JavaScript code this will be a simple JavaScript demo I will not explain everything every line in.

First of all we’ll create a variable and we will name it name now we will ask the users to enter their name and we will store his name into our variable called name.

 

 

 

So we will type in name is equal to prompt and here we will type in what is your name and after that we will display his name on our web page so we will type in document dot write and here we will type in welcome and then we will type his name. This is our simple JavaScript code we will execute this I will type in my name now when I press ok we can see that welcome and the name we provided is printed on the screen so this was a

small demo of working with JavaScript.

Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *


TechinfoHQ © 2019