JavaScript Objects Introduction
JavaScript is an object base programming language. It means every word done by object. In object base programming language we can defined own type of variable by the defined the own type of object. In JavaScript we can defined own type of function. And its can be call within the script or within another function. Function can be defined within head section of the document or body section of the document.
How to defined a function in JavaScript
<head>
<script type="text/jscript">
function myfunction() {
alert("Welcome");
}
</script>
</head>
|
How to call JavaScript function
<html>
<head>
<script type="text/javascript">
function test() {
alert("Welcome");
}
</script>
</head>
<body>
<button onclick="test()">
click</button>
</body>
</html>
|
Output

Further Readings
You may also want to read these related articles: here
Ask Your Question
Got a programming related question? You may want to post your question here