#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Answer to the questions ( JavaScript) , please


    JavaScript:

    Explain the following JavaScript code. What will the output be?

    var multipleValues = [50, 80, 100];
    console.log (multipleValues.length);
    var len = multipleValues.length;
    for (x=0; x < len; x++)
    {console.log(multipleValues[x]);}
    var reverseValues = multipleValues.reverse();
    var rlen = reverseValues.length;
    for (x=0; x < rlen; x++)
    {console.log(reverseValues[x]);}

    ------------------------------------------------------------------------------------------

    Explain the following JavaScript code. What will the output be?

    var valueOne = "15";
    var valueTwo = "30";
    var vo = vt = 0;

    vo = parseInt(valueOne);
    vt = parseInt(valueTwo);

    document.writeln("<p>The first number is " + vo + ", the second is "
    + vt + ".</p>");

    var result1 = valueOne + valueTwo;
    document.writeln("<p>The value for result1 is "
    + result1 + "</p>");

    result2 = vo + vt;
    document.writeln("<p> The value for result2 is " +
    result2 + "</p>");
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    this is no homework forum. We can help you with concrete questions and problems, but we're not here do your work.

    And this is actually something you can do yourself, even if you've been sleeping through the whole class. Grab a text editor (Notepad will do), create an HTML file, paste the JavaScript and open it in your browser. If you replace console.log() with alert(), you don't even need to create a file:

    http://jsfiddle.net/
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo