A function is a group of reusable codes. which can be called anywhere in the program. this eliminates the need of writing the same codes again and again.
By using javascript we can use an inbuilt function as well as we can create our own javascript function.
We can create javascript function by using a function keyword followed by a unique function name, can specify a list of parameters or values, and a statement block surround by curly brackets {}.
Syntax:
Function <functionname> (parameter/values list)
{
Statements;
}
e.g.
Related Topics:
By using javascript we can use an inbuilt function as well as we can create our own javascript function.
We can create javascript function by using a function keyword followed by a unique function name, can specify a list of parameters or values, and a statement block surround by curly brackets {}.
Syntax:
Function <functionname> (parameter/values list)
{
Statements;
}
e.g.
<html>
<head>
<title>My first web page</Title>
<Script language="Javascript">
Function myfunction()
{
document.write("Welcome to JavaScript");
}
</Script>
</head>
<body>
</body>
</html>
Output: Welcome to JavaScriptRelated Topics:
- JavaScript Introduction
- Variables in JavaScript
- JavaScript Function
- Accessing JavaScript Function
- Creating JavaScript interactive form
- Accessing form field value
- Creating interactive form login webpage
- Networking Fundamentals
- TCP/IP and Internet addressing
- Internet Working
- Internet Working Servers
- Concept and need for web publishing
- Web languages
- Javascript Control Structure
- Checking Text is Letter/s
- Checking Text is Number/s
- Checking Textbox is Empty or not
- Addition of two numbers
- Subtraction of two numbers
- Multiplication of two numbers
- Division of two numbers
- Form field validations
- Email validation