javascript arrow function

 JavaScript arrow function


let func1 = (a,b) => console.log(a*b);
//arrow function
func1(2,4);



hello = () => {
    return "eswar";
}
//arrow functin using brackets and return
console.log(hello());


hello1 = () => "hello all";
//arrrow function withour using the bracket and return
console.log(hello1());


hello2  = (a) => "apcfss " + a;
// arrow function with parameters
console.log(hello2(2.334));


hello3 = a => "hello "+a;
//In fact, if you have only one parameter, you can skip the parentheses as well:
console.log(hello3(23223));


hello4  = () => console.log(this);

hello4();        

Comments

Popular posts from this blog

Print prime numbers up to N and Check N is prime or not using Java Programming Language