A function tutorial for JavaScript

Source: Internet
Author: User

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.