SlideShare a Scribd company logo
1 of 21
Download to read offline
JAVASCRIPT
Prof. AshishSingh Bhatia
Brief History
2


       December 4, 1995 Netscape and Sun
        introduced JavaScript 1.0, called LiveScript.
       Netscape Navigator 2
         LiveScript    JavaScript
       Microsoft joins in with IE 3 called it Jscript.




                                 Prof. Ashish Bhatia
What is JavaScript
3


       Interpreted Language
       Object-Based
       Cross Platform
       Loosely Typed
       Multi Use Language
       Client Side interpreted.



                             Prof. Ashish Bhatia
Advantage of JavaScript
4


       An Interpreted Language
       Embedded within HTML
       Minimal Syntax – Easy to learn
       Quick Development
       Design for Simple, Small Programs
       Performance
       Procedural Capabilities
       Designed for Programming User Events

                          Prof. Ashish Bhatia
Advantage of JavaScript
5


       Easy Debugging and Testing
       Platform Independence / Architectural
        Neutral




                           Prof. Ashish Bhatia
How to add JS in HTML
6


    <script language=“javascript”>
     Java Script Code
    </script>




                    Prof. Ashish Bhatia
Data Type
7


       4 primitive data types
         Number
           Integer, Floating   Number, NaN
         Boolean
           True   and false [ 1 and 0 ]**
         String

         Null
          A   null , empty or nonexistent reference
       Complex Types like array and objects

                                    Prof. Ashish Bhatia
Creating Variables and Array
8


       var <variable name> = value;
       arrayName = new Array();
       arrayName = new Array(length);
       Index starts with 0
       join() and reverse()
       length



                       Prof. Ashish Bhatia
Variable Name
9


       Can Begin with
        A  to Z
         a to z

        _

        $

       Case Sensitive
       variableName



                         Prof. Ashish Bhatia
Operator
10


        Arithmetic Operator
         +   , - , * , / , % , ++ , --
        Logical Operator
          &&,   || , !
        Comparison Operator
          ==   , === , != , !== , < , > , <= , >=
        Assignment Operator
         =   , += , -= , *= , /= , %=


                                          Prof. Ashish Bhatia
Ternary Operator
11


        Condition ? Value 1 : value 2
        Special Operator
          delete  : Delete property of an object or an
           element at an array index
          new : Create an instance of an Object type

          void : Does not return a value.




                                Prof. Ashish Bhatia
Programming Constructs
12


        Assignment         x = x+y;
        Data declaration   var x = 5;
        If
        Switch
        While
        For
        Do while
        Label              LabelName: Statement

                            Prof. Ashish Bhatia
Programming Constructs
13


        break
        continue
        function call         x = abs(y);
        return
        with                  with(Math){ }
        delete                delete a[5]
        Method Invocation document.write(“Hello”);


                            Prof. Ashish Bhatia
Functions in JavaScript
14


        Built-in Function
          eval()

          paresInt(),   parseFloat()
        User Defined Function
         function function_name(parameter1,
           parameter2..)
         {
           block of JavaScript Code
         }

                             Prof. Ashish Bhatia
Dialog Boxes
15


        Alert
          Used to display a small textual output with ok
           button.
        Prompt
          Displays a predefined message
          Displays a text box and accepts user input
          Display ok and cancel button
            Ok  text from text box is passed to the program
             environment
            Cancel  passes NULL value to the program
             environment.
                                 Prof. Ashish Bhatia
Dialog Boxes
16


        Confirm
          Predefinedmessage
          OK and Cancel button

          OK  passes TRUE to the program

          Cancel  passes FALSE to the program




                              Prof. Ashish Bhatia
Example of Alert
17




                   Prof. Ashish Bhatia
Example of Alert
18




                   Prof. Ashish Bhatia
Example of Alert
19




                   Prof. Ashish Bhatia
Youtube channel
20


        http://www.youtube.com/profashish




                           Prof. Ashish Bhatia
Slideshare
21


        http://www.slideshare.net/ashishsinghbhatia




                            Prof. Ashish Bhatia

More Related Content

Similar to Java script

FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
Mario Fusco
 

Similar to Java script (20)

PRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptxPRESENTATION ON PYTHON.pptx
PRESENTATION ON PYTHON.pptx
 
JavaScript(Es5) Interview Questions & Answers
JavaScript(Es5)  Interview Questions & AnswersJavaScript(Es5)  Interview Questions & Answers
JavaScript(Es5) Interview Questions & Answers
 
Java beans
Java beansJava beans
Java beans
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
 
EEE 3rd year oops cat 3 ans
EEE 3rd year  oops cat 3  ansEEE 3rd year  oops cat 3  ans
EEE 3rd year oops cat 3 ans
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
 
Scalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedInScalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedIn
 
PHP Reviewer
PHP ReviewerPHP Reviewer
PHP Reviewer
 
PHP 5.5.0 ChangeLog
PHP 5.5.0 ChangeLogPHP 5.5.0 ChangeLog
PHP 5.5.0 ChangeLog
 
Module 12 aggregation, namespaces, and advanced scope
Module 12 aggregation, namespaces, and advanced scopeModule 12 aggregation, namespaces, and advanced scope
Module 12 aggregation, namespaces, and advanced scope
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Java 8 new features or the ones you might actually use
Java 8 new features or the ones you might actually useJava 8 new features or the ones you might actually use
Java 8 new features or the ones you might actually use
 
Clean Code
Clean CodeClean Code
Clean Code
 
Generics
GenericsGenerics
Generics
 
Introduction to-java
Introduction to-javaIntroduction to-java
Introduction to-java
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
 
Java 2
Java   2Java   2
Java 2
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
 
Php web development
Php web developmentPhp web development
Php web development
 
Google Dart
Google DartGoogle Dart
Google Dart
 

More from AshishSingh Bhatia (6)

Servlet Filter
Servlet FilterServlet Filter
Servlet Filter
 
Dom Basics
Dom BasicsDom Basics
Dom Basics
 
Java I/O Part 2
Java I/O Part 2Java I/O Part 2
Java I/O Part 2
 
Java I/O Part 1
Java I/O Part 1Java I/O Part 1
Java I/O Part 1
 
Nested and Enum Type in Java
Nested and Enum Type in JavaNested and Enum Type in Java
Nested and Enum Type in Java
 
Http and Servlet basics
Http and Servlet basicsHttp and Servlet basics
Http and Servlet basics
 

Java script

  • 2. Brief History 2  December 4, 1995 Netscape and Sun introduced JavaScript 1.0, called LiveScript.  Netscape Navigator 2  LiveScript  JavaScript  Microsoft joins in with IE 3 called it Jscript. Prof. Ashish Bhatia
  • 3. What is JavaScript 3  Interpreted Language  Object-Based  Cross Platform  Loosely Typed  Multi Use Language  Client Side interpreted. Prof. Ashish Bhatia
  • 4. Advantage of JavaScript 4  An Interpreted Language  Embedded within HTML  Minimal Syntax – Easy to learn  Quick Development  Design for Simple, Small Programs  Performance  Procedural Capabilities  Designed for Programming User Events Prof. Ashish Bhatia
  • 5. Advantage of JavaScript 5  Easy Debugging and Testing  Platform Independence / Architectural Neutral Prof. Ashish Bhatia
  • 6. How to add JS in HTML 6 <script language=“javascript”> Java Script Code </script> Prof. Ashish Bhatia
  • 7. Data Type 7  4 primitive data types  Number  Integer, Floating Number, NaN  Boolean  True and false [ 1 and 0 ]**  String  Null A null , empty or nonexistent reference  Complex Types like array and objects Prof. Ashish Bhatia
  • 8. Creating Variables and Array 8  var <variable name> = value;  arrayName = new Array();  arrayName = new Array(length);  Index starts with 0  join() and reverse()  length Prof. Ashish Bhatia
  • 9. Variable Name 9  Can Begin with A to Z  a to z _ $  Case Sensitive  variableName Prof. Ashish Bhatia
  • 10. Operator 10  Arithmetic Operator + , - , * , / , % , ++ , --  Logical Operator  &&, || , !  Comparison Operator  == , === , != , !== , < , > , <= , >=  Assignment Operator = , += , -= , *= , /= , %= Prof. Ashish Bhatia
  • 11. Ternary Operator 11  Condition ? Value 1 : value 2  Special Operator  delete : Delete property of an object or an element at an array index  new : Create an instance of an Object type  void : Does not return a value. Prof. Ashish Bhatia
  • 12. Programming Constructs 12  Assignment x = x+y;  Data declaration var x = 5;  If  Switch  While  For  Do while  Label LabelName: Statement Prof. Ashish Bhatia
  • 13. Programming Constructs 13  break  continue  function call x = abs(y);  return  with with(Math){ }  delete delete a[5]  Method Invocation document.write(“Hello”); Prof. Ashish Bhatia
  • 14. Functions in JavaScript 14  Built-in Function  eval()  paresInt(), parseFloat()  User Defined Function function function_name(parameter1, parameter2..) { block of JavaScript Code } Prof. Ashish Bhatia
  • 15. Dialog Boxes 15  Alert  Used to display a small textual output with ok button.  Prompt  Displays a predefined message  Displays a text box and accepts user input  Display ok and cancel button  Ok  text from text box is passed to the program environment  Cancel  passes NULL value to the program environment. Prof. Ashish Bhatia
  • 16. Dialog Boxes 16  Confirm  Predefinedmessage  OK and Cancel button  OK  passes TRUE to the program  Cancel  passes FALSE to the program Prof. Ashish Bhatia
  • 17. Example of Alert 17 Prof. Ashish Bhatia
  • 18. Example of Alert 18 Prof. Ashish Bhatia
  • 19. Example of Alert 19 Prof. Ashish Bhatia
  • 20. Youtube channel 20  http://www.youtube.com/profashish Prof. Ashish Bhatia
  • 21. Slideshare 21  http://www.slideshare.net/ashishsinghbhatia Prof. Ashish Bhatia