JAVASCRIPT INTRODUCTION

JAVASCRIPT INTRODUCTION



Javascripts



INTRODUCTION

Javascript is the programming language of the web. It is used mainly for validating froms. Javascript and java can be related to each other. There exists many other differences between the two. The client interprets javascript, whereas in java, one can execute a java file only after compiling it. 

Javascripts is based on an object model. In this unit you will learn how to write Javascript code and insert them into your HTML documents, and how to make your pages more dynamic and interactive.

We will also learn about object based programming in javascript. We will also discuss some commonly used objects, message boxes and forms. One of the most important parts of javascript is Event handling that will allow you to write Event-driven code.


OBJECTIVES

After going through this unit you would be able to learn and use the followingfeatures of the javascript:

Operator;
Loop constructs;
Functions;
Objects such as Math object, Date object;
Input and output boxes;
Even handles;
Form handles; and
Form array.


JAVASCRIPT DATA TYPES AND DATA STRUCTURE

Programming languages all have built-in data structures, but these often differ from one language to another. This article attempts to list the built-in data structures available in JavaScript and what properties they have; these can be used to build other data structures. Wherever possible, comparisons with other languages are drawn.

DATA TYPE


Data type in javascript


A value, the data assigned to a variable, may consist of any sort of data. However , javascript consider data to fall into several possible types. Depending on the type of data, certain operator may or may not be allowed on the values. For example, you cannot arithmetically multiply two string values.


The latest ECMAScript standard defines seven data types:
  • Six data types that are primitives:
  • Boolean
  • Null
  • Undefined
  • Number
  • String
  • Symbol (new in ECMAScript 6)
      and Object. 
            CONTROL STRUCTURES

            Javascript supports the usual control srtuctures:

            • The conditionals if, if...else, and switch;
            • The iteration for, while, do... while, break, and continue;



            How to use Conditional Statements

            Conditional statements are used to decide the flow of execution based on different conditions. If a condition is true, you can perform one action and if the condition is false, you can perform another action.

            Conditional statement in Javascript

            Different Types of Conditional Statements

            There are mainly three types of conditional statements in JavaScript.
            1. If statement
            2. If…Else statement
            3. If…Else If…Else statement.



            Hello World in JavaScript 

             

            <!DOCTYPE html>
            <html>
            <head>
             <title>Hello World in JavaScript</title>
            </head>
            <body>
             <h2>Hello World In Java</h2>
             <script type="text/javascript">
              alert("Hello World in JavaScript");
              console.log("Hello World");
             </script>
            
            </body>
            </html>
            

            0 comments:

            Post a Comment