edit-article
Home
Up
Delete
Article Name:
Article Description:
]javascript languages NATIVE 'Function' object
Chapter ID/Name:
Status:
Write
Writing
Written
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">language object - Function</h1> <h2>[WHAT]</h2> <ol> <li>[] The <strong>function declaration</strong> (function statement) defines a function with the specified parameters.</li> <li>[] You can also define functions using the <a title="The Function constructor creates a new Function object. Calling the constructor directly can create functions dynamically, but suffers from security and similar (but far less significant) performance issues to eval. However, unlike eval, the Function constructor creates functions which execute in the global scope only." href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function"><code>Function</code></a> constructor and a <a title="The function keyword can be used to define a function inside an expression." href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function" target="_blank"><code>function expression</code></a>.</li> </ol> <h2>[WHY]</h2> <ol> <li>[] </li> </ol> <h2>[WHERE]</h2> <ol> <li>[]</li> </ol> <h2>[WHEN]</h2> <ol> <li>[]</li> </ol> <h2>[EXAMPLE]</h2> <ol> <li><strong>[] function declaration - declares/defines what the function will do</strong></li> </ol> <p>function addTwo(a,b){</p> <p> return a+b;</p> <p>}</p> <ol> <li><strong>[] function execution - executes the given function with the required parameters and returns the result of the execution</strong> </li> </ol> <div>let sum = addTwo(3,4);</div> <div>console.log(sum); // 7</div> <h2>[HOW-TO]</h2> <ol> <li>[]</li> </ol> <h2>[REFERENCE]</h2> <ol> <li>[] <span class="crayon-sy"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function</a></span></li> </ol> <h2>[RELATED]</h2> <div><ol> <li>[]</li> </ol></div>