Function in the javascript

technical talkiess
0

 Javascript Function :- 


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

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

    <title>Javascript Function</title>

</head>

<script>

    // this is basic function and name is parameter and greet text is another parameter  

    // agar apne greettext ko nahi bheja to apka function bydefault greetText="This is empty case parametr" ye wali value lenga


    function greet(name,greetText="This is empty case parametr"){

    // function greet(name,greetText){

        console.log(name +' '+ greetText)

    }


    // return function in javascript


    function sum(a,b){

        let c = a+b;

        return c;

        // return ke bad ka codde run nahi hota hai

        console.log("test")

    }


    let sum_number = sum(4,4);

    console.log(sum_number);

    let name = "vishal";

    let greetText = "Good morning";

    // all parameter send

    // greet(name,greetText)

    // only name is send greetText="This is empty case parametr" .... the fuction automatic received the this line in greeting

    // greet("rohan")


</script>

<body>

    <div class="container">

        <p>Javascript function</p>

    </div>

</body>

</html>
Tags

Post a Comment

0Comments

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

Post a Comment (0)