From WikiEducator
Jump to: navigation, search
Home  |  About UOU  |  About CEMCA  |  Contact Us    

Unit 3.3 Web application development tools & Technologies

3.3.5 JavaScript Data Types Variables Operators Conditional statement Dialog Boxes Functions Functions

Functions are the JavaScript statements to perform a specific task and can return a value. JavaScript function may take zero or more parameters.

Pre-defined functions

JavaScript provides several built-in functions.

e.g. functions to perform explicit type conversion like eval(). parseInt(), parseFloat() etc.

var variable_name = function_name(parameter/s list);

eval() function is used to evaluate a

string parameter(mathematical expression) to a numeric value.

val total = eval (“10+5+20”);

User-defined functions

User-defined functions are the JavaScript statements coded into a single unit to perform a specific task that can be used in many places whenever required.

function function_name(parameter 1, parameter 2, . . .){
// JavaScript statements

<TITLE> Demonstating UDF </TITLE>
<SCRIPT type="text/javascript" >
function udf() {
   alert("Hello there");
<BODY onLoad="udf();">
Demonstrating User Define Function.


Suggested Reading
  • Web Applications

 Suggested Videos
  • Video 01 Title
  • Video 02 Title
  • Video 03 Title