---
title: "How to pass parameter values in javascript arrow function?"  
description: "How to pass parameter values in javascript arrow function?"  
author: "Utpal Vishwas"  
published: 2023-10-08  
updated: 2023-10-11  
canonical: https://www.mindstick.com/forum/160054/how-to-pass-parameter-values-in-javascript-arrow-function  
category: "javascript"  
tags: ["javascript", "arrow function"]  
reading_time: 2 minutes  

---

# How to pass parameter values in javascript arrow function?

How to pass [parameter values](https://www.mindstick.com/forum/159230/is-default-parameter-values-supported-in-java) in the [javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript) [arrow function](https://www.mindstick.com/forum/160055/how-to-create-parameterize-arrow-function-in-javascript)?

## Replies

### Reply by Aryan Kumar

In JavaScript, [arrow](https://answers.mindstick.com/qa/95602/which-country-test-flighted-arrow-3-anti-ballistic-missile-system-and-its-interceptors) functions are a concise way to create functions, and they can accept parameters just like regular functions. You can pass [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) [values](https://www.mindstick.com/forum/327/sum-textbox-values) to arrow functions by specifying them in the parentheses that follow the arrow symbol (**=>**). Here's the basic syntax for creating arrow functions with parameters:

```plaintext
(param1, param2, ...) => {
  // Function body
  // You can use param1, param2, and so on within this function
}
```

Here's an example of an arrow [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) with parameters:

```plaintext
const add = (a, b) => {
  return a + b;
};

console.log(add(5, 3)); // Outputs 8
```

In this example, the **add** arrow function accepts two parameters, **a** and **b**, and returns their sum.

You can also create arrow functions with a single parameter without using parentheses, like so:

```plaintext
param => {
  // Function body
  // You can use param within this function
}
```

Here's an example:

```plaintext
const square = x => {
  return x * x;
};

console.log(square(4)); // Outputs 16
```

Arrow functions are commonly used for shorter, concise functions and are particularly useful for functions where you need to pass parameters or return values quickly.


---

Original Source: https://www.mindstick.com/forum/160054/how-to-pass-parameter-values-in-javascript-arrow-function

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
