Professional Documents
Culture Documents
Arrow
Arrow
<!DOCTYPE html>
<body>
<script>
const num=(x)=> x*x;
console.log(num(38)); /* o/p:3364 */
const C=(str1,str2,str3)=>str1+str2+str3;
console.log(C("I","am","Janet")); /*IamJanet
const cArea=(length,width)=>length*width;
console.log(cArea(77,46)); /*3542*/
const cArea=(length,width,height)=>(length*width)/height;
console.log(cArea(77,46,2)); /*1771*/
const fR=(n)=>{
if (n === 0 || n === 1)
{
return 1;
}
return n * fR(n - 1);
}
console.log(fR(8)); /*40320*/
console.log(fR(1)); /* 1 */
const fR=(n)=>{
return (n === 0 || n === 1) ? 1 : n * fR(n - 1);
}
console.log(fR(7)); /* 5040 */