1. Question:What are the characteristics of JavaScript? 

    Answer
    1) JavaScript Lives in a Web Page
    2) JavaScript is not server side language. It is client side language because it is interpreted and run on the browser.
    3) It is weakly typed because it does not need to specify datatypes to declare variable (int, float, double etc) like c/c++.
    4) It is not programming language. It Interpreted language because browsers are interpret it.
    5) JavaScript is case sensitive.
    6) Semicolon(;) is optional
    7) String can be enclosed by using single quote (‘) or double quote(“”)
    8) // is used to specify single line comment and /* ... */ is used to specify multiline comment.

    1. Report
  2. 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
  3. Question:What do you mean by local and global variable? 

    Answer
    Global variable: A global variable, as the name implies, has global scope and is defined in the entire script.
    Local variable: Local variables are local to the functions in which they are defined.

    1. Report
  4. Question:What is the difference between while and do-while loop? 

    Answer
    While loop: 1. Initialization->condition->statement/increment is the sequence of while loop execution. 
    2. The while loop begins with a termination condition and keeps looping until the termination condition is met.
    3. If the condition is not true, none statement will execute within the loop because condition is checked before executing the statement.

    Do-while loop: 1. Initialization->statement/interment->condition is the sequence of do-while loop execution.
    2. Unlike the while loop, the do-while loop always executes statements in the loop in the first iteration of the loop.
    3. As the condition is checked after executing statements in the loop, at least once loop statements will be executed within the loop even if condition is false.

    1. Report
  5. Question:What is the function of break and continue statement? 

    Answer
    Break: "break" statement is used to exit from loop and selection structure. break statement is widely used in switch-case and loop.
    continue:

    Continue: The "continue" statement tells the interpreter to immediately start the next iteration of the loop and skip remaining code block.

    1. Report
  6. Question:What is JavaScript Events and events handler? 

    Answer
    1. Events are actions that can be detected by JavaScript.
    2. Every element on a web page has certain events which can trigger a JavaScript.
    3. Events are normally used in combination with functions.

    Examples of events: -Clicking a button (or any other HTML element)
    -A page is finished loading
    -An image is finished loading
    -Moving the mouse-cursor over an element
    -Entering an input field
    -Submitting a form
    -A keystroke

    Event handler: Event handlers are the way JavaScript deals with events. JavaScript contains a variety of event handlers for various purposes.
    Example of some event handlers are: onclick, onload, onkeypress, onmouseover etc.

    1. Report
  7. Question:

    What do you mean by Array? How will you declare an array?

     

    Answer
    Array
    1. Array is a compound data structure in computing.
    2. It is as a collection of numbered variable.

    An array in javaScript have the following general syntax to declare:

    1. var a=new Array();
    2. var a=[];


    1. Report
  8. Question:What is the difference between “==” and “===” operator? 

    Answer

    1. Both are comparison operators but
    2. "==" test for equally operator compares its operands with only value ignoring the datatype.
    3. Whereas "===" test for strict equally operator compares its operands with datatypes and the value.

    1. Report
  9. Question:What do you mean by “with” statements? Write it’s syntax. 

    Answer

    With statement:


    1. JavaScript’s with statement was intended to provide a shorthand for writing recurring accesses to objects.
    2. Instead of having to list all of the properties of an object by repeating the basic object, we can state the bulk of the object in a with statement and then the properties within the context of the with statment.

    Syntax:
    with (object){
      statement
    }

    Example:
    var a, x, y;
    var r = 10;
    with (Math) {
      a = PI * r * r;
      x = r * cos(PI);
      y = r * sin(PI / 2);
    }

    1. Report
  10. Question:What do you mean by DOM? Write its properties. 

    Answer

    The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTML, XHTML and XML documents.

    Some of Document Properties:
    a. AlinkColor
    b. Anchors[array]
    c. BgColor
    d. Cookie
    e. Domain
    g. Forms[array]
    h. Images[array]
    i. LinkColor
    j. Links[array]
    k. Location
    l. Title

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