1. Question:What is history object? Write methods of it. 

    Answer

    history object: 1. The history object is a property of the window object. It has a single property name length.
    2. The history object contains the URLs visited by the user (within a browser window).

    functions: 1. back() - Loads the previous URL in the history list.
    2. forward() - Loads the next URL in the history list.
    3. go() - Loads a specific URL from the history list.






    1. Report
  2. Question:

    What do you mean by cookies?

     

    Answer

    Cookie:

    1. A cookie is usually a small piece of data sent from a website and stored in a user's web browser while a user is browsing a website.
    2. When the user browses the same website in the future, the data stored in the cookie can be retrieved by the website to notify the website of the user's previous activity.
    3. Cookies were designed to be a reliable mechanism for websites to remember the state of the website or activity the user had taken in the past

    The general format for setting a cookie is this:

    document.cookie=value;[expires];[path];[domain];[secure];






    1. Report
  3. Question:What is reserved word? Write five reserved word. 

    Answer

    1. Reserved words are those in JavaScript that have been reserved for statements and bulit-in functions.
    2. We should avoid creating identifier for variable and functions that are identical to JavaScript reserved word.

    Five reserved words are:

    1. function
    2. for
    3. return
    4. break
    5. continue






    1. Report
  4. Question:Write about interpreted and loosely typed language according to JavaScript? 

    Answer

    An Interpreted Language:
    The process involves by browser parsing (interpreting) the JavaScript code and then creating an equivalent machine language and execute the interpreted code.

    Loosely typed language: The language that does not require to specify the datatype (int, float, boolean, string etc.) before declaring variables.







    1. Report
  5. 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
Copyright © 2025. Powered by Intellect Software Ltd