Arrow function in the javascript

technical talkiess
0

 Arrow function in the javascript:- 


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Arrow function in javascript</title>

</head>

<body>

    <script>

        // function greet(){

        //     console.log("This is the Function one ")

        // }


        // greet();

        // this is calla arraow function

        let greet = ()=>{

            console.log("This is arraow function");

        }


        // greet();


        // agar apko parameter dene hai to bracket dena padenga apko

        let sum = (a,b)=>{

            console.log(a+b);

        }

        // sum(2,2);


        // agar apke function me khali ek hi parameter hai to apko bracket dene ki jarurat nahi hai


        let square = a => console.log(a*a);


        // square(2);



       let  obj1 = {

            bye_text : " Good By see you tommrrow",

            names : ['vishal','naga ','kelya ','boss'],

            namesof(){

                this.names.forEach((name) => {

                    console.log("Hello "+ name + this.bye_text)

                });

            }

           

        }

        obj1.namesof();

    </script>

</body>

</html>


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)