1. Question:What are the functions of return statement? 

    Answer
    1. The role of the return statement is to provide the value of the expressions within the function.
    2. Whenever the return keyword occurs in the function it returns the value instantly as specified and end the function execution.

    1. Report
  2. Question:What is function? How can you define function in JavaScript? 

    Answer

    Function:


    1. A colloection of statements/code which can perform a specific task and can be executed by an event of call to that function.
    2. We can have a) Built-in function and 2) User-defined functions

    Syntax of defining a function:

    function functionName(functionParameter list){
     
       statements

    }

    Example:

    function add(a,b){
       return a+b;
    }

    1. Report
  3. Question:What is eval() in javaScript? 

    Answer
    The eval() function evaluates or executes an argument.If the argument is an expression, eval() evaluates the expression. If the argument is one or more JavaScript statements, eval() executes the statements.
    var x = 10;
    var y = 20;
    var a = eval("x*y") + "<br>";
    var b = eval("2+2") + "<br>";
    var c = eval("x+17") + "<br>";
    
    var res = a + b + c;
    The result of res will be 200 4 27

    1. Report
  4. Question:Define concatenation. 

    Answer
    The concatenation is a process to join two or more strings or strings and other literals.Generally '+' is used to concatenate strings.
    For Example:
    var str=("Bangla"+"desh")
    output:Bangladesh

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd