Functions of JavaScript
If you have any programming experience, you don't need to spend too much time on this lesson. The JavaScript function behaves in the same number of programming languages (C, C + +, PHP, etc.). If this is your first time learning function, then be sure to go through this lesson very thoroughly. A solid understanding of the function will make the rest of this tutorial easier to follow.
What is a function?
A function is a piece of code that sits dormant until it references or calls to do its "function". In addition to controllable execution, functions also save time for repetitive tasks.
Instead of entering the code every time you want to make a difference, you can simply invoke the function multiple times to get the same effect. This benefits from also being called "code reuse."
For example, in JavaScript features
When a function is not executed, the page load should be placed inside the owner of your HTML file. Creating a feature is really easy. All you need to do is to tell the browser that you have played a role in making the feature name and then writing JavaScript as normal. The following are examples of reminders that feature from previous lessons.
<script type= "Text/javascript" >
<!--
function popup () {
Alert ("Hello World")
}
-->
</script>
<body>
<input type= "button" onclick= "popup ()" Value= "Popup" >
</body>