Javascript introduction

Today i would like to share my knowledge on javascript introduction,Here we have web forms on your website that your visitor needs to fill out that form ,Content will need to be validated before it can be processed,Instead of sending request to server to validate forms.

we use javascript code in our HTML pages for client side validations and also use for calculations,Now i will try to start with basics for the beginners,those who know about basics can simple exclude this article.

How to declare variables in javascript ? and how to write javascript  code in between script tags as below.

<script> // script open tag

code here ...

</script>// script closing tag

 

 

javascript2

Rules and regulations to declare variables
1) No spaces in variable name.
2) We can begin with lowercase letters and later capitalized.
3) Should not use numbers before variable.
4) We can use underscore symbol to separate variable name eg:- variable_name.

javascript3

javascript4

<script>
var variableOne="Welcome to eknowledgetree";
var variableTwo="welcome To EknowledgeTree";
//compare two strings

if(variableOne == variableTwo)//Here the two variable value is same but condition false, because JavaScript is case sensitive .

{
  alert("condition is true");
}else
{
alert("condition is false");
}

</script>

Here if the condition fails ,else condition will execute and popup a message.
Thanks for reading this article .

Leave a Reply