Arrow Functions tutorial in Advance JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Arrow Functions tutorial Advance JavaScript</title>
    <link rel="stylesheet" href="">
</head>

<body>
    <script>
        //Simple way making Function as shown below :
        let welcome = function (name) {
            return `Hello and Welcome ${name}`;
        };
        document.write(welcome("brother and sister<br><br>"));

        //Making Arrow Function as shown below :
        let welcomeTwo = (name, age) => {
            return `Hello and Welcome ${name} and your age is ${age}`;
        };
        document.write(welcomeTwo("brother and sister", 25));
        document.write("<br><br>");
        document.write(typeof welcomeTwo);
        document.write("<br><br><br><br>");

        //Making Arrow Function in single Line as shown below :
        let welcomeThree = name => `Welcome ${name}`;
        document.write(welcomeThree("brother"));
        document.write("<br><br>");
        document.write(typeof welcomeThree);
    </script>
</body>

</html>


Comments

Popular posts from this blog

Symbols tutorial in Advance JavaScript

Async and Await Method tutorial in Advance JavaScript

String Methods in JavaScript