The following code shows an Example of Arrow Function in JavaScript.

Basically, we use arrow functions when we need to write a concise function. It represents a shorter syntax of the function. The following code example shows an arrow function to find the power of a number.

    <title>Arrow Functions in JavaScript</title>
      let powerFunction = (x, y) => {
	  return p;
      function findPower()
	a=Number(prompt('Enter the value of x: '));
	b=Number(prompt('Enter the value of y: '));	
        alert(a+' raise to the power '+b+' is '+powerFunction(a, b));
         margin: 100px;
         padding: 50px;
         border: 2px black solid;
         text-align: center;
		<button onclick="findPower()">Find Power</button>


Demonstrating an Example of Arrow Function in JavaScript
Demonstrating an Example of Arrow Function in JavaScript
Arrow Function
Arrow Function
Arrow Function for Power
Arrow Function for Power

Further Reading

Evolution of JavaScript from ES1 to ES2020

Introduction to HTML DOM Methods in JavaScript

JavaScript Practice Exercise

Understanding Document Object Model (DOM) in JavaScript

What is Asynchronous JavaScript?

Understanding JSON Web Tokens

Arrow Functions in JavaScript

Understanding HTTP Requests and Responses