Ask Question

In Js how will you declare and intialize an obejct an array

+1
Answers (1)
  1. 22 April, 14:06
    0
    In jа vascript array are the special type of object, to store the multiple value in single variable we used array in jа vascript.

    Explanation:

    We can create an array in jа vascript by using following syntax

    var arrayname=[value1, value2 ... valuen];

    For example:

    var st=["san","ran", tan"];

    In jа vascript array are treated as object.

    we can declare and initialize an object of array

    var st=["san","ran", tan"]; / / declaring array

    document. getElementById ("d2"). innerHTML = st[0]; / / accessing the member of array by array object.

    In this st object access the first element in the array.

    Following are implementation of declare and initialize an object an array

    Output:

    san
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “In Js how will you declare and intialize an obejct an array ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers