Mahesh Chandran Pillai.  JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational.

Similar presentations

Presentation on theme: "Mahesh Chandran Pillai.  JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational."— Presentation transcript:

1
Mahesh Chandran Pillai

2
 JavaScript is an implementation of the ECMAScript language standard and is typically used to enable programmatic access to computational objects within a host environment.  It can be characterized as a prototype-based object-oriented scripting language that is dynamic, weakly typed and has first-class functions Mahesh Chandran Pillai

3
 JavaScript is primarily used in the form of client-side JavaScript, implemented as part of a web browser in order to provide enhanced user interfaces and dynamic websites. Mahesh Chandran Pillai

5
 Access other resources such as Files, Databases and Programs  Talk to Web Servers  Give similar output on different browsers  Be encrypted.  Be used with copyrighted data or algorithms Mahesh Chandran Pillai

6
 A script that is executed by the browser on a users computer  Instead of the entire page, part of the page is sent to the browser when user requests for the page.  Mostly run in response to an event  For example: Click events, validations.  Direct interaction with client Mahesh Chandran Pillai

10
 JavaScript is case-sensitive   Ending statements with a semicolon is optional.   Open and Close braces for scoping the embedded Java Script code is mandatory.   You can apply more than one script in a same HTML file. Mahesh Chandran Pillai

17
 For Loop › The for loop is applied when you know in advance, how many times the script should run. › For loop Syntax: var initval; for(initval=startvalue; initval<=endalue; initval=initval+incrval) { code to be executed } Mahesh Chandran Pillai

19
 For … in Loop › The for..in statement is applied to loop (iterate) through the elements of an array or through the properties of an object. › Syntax: for (variable in object) { code to be executed } Mahesh Chandran Pillai

20
Functions can be of two types.  Built in Functions › Functions which are provided by Javascript.  User Defined Functions › A function is identified by the keyword function, followed by a programmer-supplied name for the function, and followed by a set of parentheses that optionally enclose data values needed by the function to carry out its processing. › Syntax: function function_name(parameters) { function-body; } Mahesh Chandran Pillai

21
 Calling Functions › You can call a function by using it name followed by parenthesis with parameters if defined. Function_name(parameters); › You can call functions with event handlers › You can avoid functions by writing inline scripts  It is useful only for avoiding small functions. Mahesh Chandran Pillai

24
 document.write (str) › This function will help you to write any string message to the web page. Mahesh Chandran Pillai

25
 Date › The Date Object type provides a common set of methods for working with dates and times.  String › The String Object type provides a set of methods for › manipulating strings.  Math › The Math Object type provides a common set of methods for working with mathematical tasks. Mahesh Chandran Pillai

26
NameDescription getDate()The day of the month as an integer from 1 to 31 getDay()The day of the week as an integer where 0 is Sunday and 1 is Monday getHours()The hour as an integer between 0 and 23 getMinutes()The minutes as an integer between 0 and 59 getMonth()The month as an integer between 0 and 11 where 0 is January and 11 is December getSeconds()The seconds as an integer between 0 and 59 getTime()The current time in milliseconds where 0 is January 1, 1970, 00:00:00 getYear()The year, but this format differs from browser to browser Mahesh Chandran Pillai

28
NameDescription exp()Value of e raised to the power passed as the argument Abs()Absolute value of the sqrt()Square root of the argument round()Argument rounded up if its decimal value is greater than or equal to 0.5 and rounded down otherwise pow()First argument raised to the power passed as the second argument random()Random number between 0 and 1 min()Lower of the two numbers passed as arguments Max()Higher of the two numbers passed as arguments Log()Natural log of the argument floor()Integer lower than or equal to the number passed as the argument ceil()Integer greater than or equal to the number passed Mahesh Chandran Pillai

29
NameDescription escape(string)Encodes a string from ASCII into an ISO Latin-1. Unescape()encodes a string from ISO Latin-1 to ASCII Eval()Converts a string to integer or float value. It can also evaluate expressions included with a string. isNaN(value)If the value passed is a not a number, the Boolean value of true is returned, if it is a number, it returns false. typeof operatorThis is an operator but its usefulness is similar to a function. This operator returns the type of the object it operates on. parseInt()Converts a string to an integer returning the first integer encountered which is contained in the string. parseFloat()Returns floating point numbers the same as the parseInt function, but looks for floating point qualified strings and returns their value as a float. toString()Converts an object to a string