# functions function is a block of code designed to perform a particular task. The first one is that functions are created or defined, and they are later called. // function definition function calculateBill() { // this is the function body console.log("Running Calculate Bill!!"); } // function call or function invocation calculateBill(); Variables that are created inside of a function are only available within that function, which is called block scoping return is a keyword in JavaScript. A best practice in JavaScript is to keep your code DRY, which stands for Don't Repeat Yourself. Two types of function - declaration - expression An easy to remember rule: the function declaration in a statement always starts with the keyword function. Otherwise it’s a function expression ```javascript= function App() { /// this is a function body } or A function expression can be stored in a variable: like:-- const App = () => {} const Users = [] Users.push(function() {}) const Cars = { run: function() {} } ``` # parameter(props) & arguments ```javascript= // props = argument function App(props) { props.name } // "Welcome parameter" App({ name: "India" }) function App(props) { props[0] } App(["Welcome"]) // name - property <App name="Welcome" /> ``` ![](https://i.imgur.com/Nx7xZpR.png) Functions are Objects JavaScript functions have both properties and methods. The arguments.length property returns the number of arguments received when the function was invoked: function myFunction(a, b) { return arguments.length; } Arrow functions allows a short syntax for writing function expressions. // ES5 var x = function(x, y) { return x * y; } // ES6 const x = (x, y) => x * y;