A function in Javascript is a group of statement that is executed when it's triggered. A function can be called from anywhere within the page. As it is the part of javascript it is defined under the <script> tag.