SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,892
    Mentioned
    211 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Welcome to the forums!

    This looks remarkably like an assignment, so I would be surprised if anyone gives you the answers outright.
    Why don't you try and work out the answers yourself and post back here if you get stuck.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •