Arrow Functions in Javascript
<html>
<head>
<title>Arrow functions </title>
<script>
var fun=function(){
return "Hello Compuhelp";
}//end of function
function test(f)
{
return f();
}
function useArrow()
{
// div1.innerHTML= div1.innerHTML + fun();
//div1.innerHTML= div1.innerHTML+ test(fun);
const x=(nm)=>"I am arrow function" + nm;
head3.innerHTML=x("compu");
//return "hello compu";
}
</script>
</head>
<body>
<div id="div1">
<h2 id="head2">Use of Arrow functions in javascript</h2>
<button onclick="useArrow()">Use Arrow Functions</button>
<h3 id="head3"></h3>
</div>
</body>
</html>
Comments
Post a Comment