Question

Given the following JavaScript code, what will be displayed on the web page?

var i, j;

for (i=1; i<=3; i++)

{

     for (j=2; j<=5; j++)

     {

           document.write(i+ "," + j + "; ");

     }

     document.write("<br>");

}

2,3;
3,4;
4,5;
4,6;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

OUTPUT:

EXPLANATION:

i j Output
1

2

3

4

5

1,2;1,3;1,4;1,5;
2

2

3

4

5

2,2;2,3;2,4;2,5;
3

2

3

4

5

3,2;3,3;3,4;3,5;

For each value of i=1,2,3 inner loop will go through values j=2,3,4,5 and so i,j are printed. After each iteration of i, there is <br> so after each iteration of i, line has been changed.

Add a comment
Know the answer?
Add Answer to:
Given the following JavaScript code, what will be displayed on the web page? var i, j;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following JavaScript skeletal program: //the main program var x: function sub1 () { var...

    Consider the following JavaScript skeletal program: //the main program var x: function sub1 () { var x: function sub2 () { } } function sub3 () { } Assume the execution of this program is in the following unit order: main calls sub1 sub1 calls sub2 sub2 calls sub3 a. Assuming static scoping, which declaration of x is the correct one for a reference to x in: i. sub1 ii. sub2 iii. sub3 b. Repeat part a, but assume dynamic...

  • Please help me with the following requirements for JavaScript. Write a function to take a temperature value in Celsius a...

    Please help me with the following requirements for JavaScript. Write a function to take a temperature value in Celsius as an argument and return the equivalent temperature in Fahrenheit, basing it on the code from Hour 2. //Original Code <!DOCTYPE html> <html> <head>     <title>Fahrenheit From Celsius</title> </head> <body>     <script>         var cTemp = 100;  // temperature in Celsius         var hTemp = ((cTemp * 9) /5 ) + 32;         document.write("Temperature in Celsius: " + cTemp + " degrees<br/>");         document.write("Temperature in Fahrenheit: "...

  • 1. Given the following code snippet, what is the scope of the variable pen on Line...

    1. Given the following code snippet, what is the scope of the variable pen on Line 1? <script> 1.    var pen = "ball point"; 2.    var pencil = "0.7mm lead"; 3.    function writeIt() 4.    { 5.          document.write(I have a " + pen + " pen."); 6.          pen = "gel ink"; 7.         document.write("You have a " + pen + " pen."); 8.          var pencil = "0.5mm lead"; 9.          document.write("I prefer pencils with " + pencil + "."); 10.   } <script> A. global B....

  • web problem, JavaScript language for the Web Explain what is wrong with the following code and...

    web problem, JavaScript language for the Web Explain what is wrong with the following code and then fix it. [I want to submit a GET request to the server and I must send the account ID.] async function getAccountInfo () { const res = await fetch('http://example.com/account', { method: 'GET', body: JSON.stringify ({accountID: 123}), headers: {'Content-Type': 'application/json'} }); const accountInfo = await res.json (); console.log (accountInfo);

  • Consider the following. (Assume that the dice are distinguishable and that what is observed are t...

    Consider the following. (Assume that the dice are distinguishable and that what is observed are the numbers that face up.) HINT [See Examples 1-3.] Two distinguishable dice are rolled; the numbers add to 7. Describe the sample space S of the experiment. (Select all that apply.) (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) (6,1) (6,2) (6,3) (6,4) (6,5) (6,6) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) (3,7) (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) (2,7) (1,1) (1,2)...

  • i need help with this homework web page and i need the code too Using the "do while" or the "for" contr...

    i need help with this homework web page and i need the code too Using the "do while" or the "for" control statements, have a visitor to your Web page do, or see, something repeatedly. You could have him or her enter a number of months, an interest-rate, and an amount, and print out a table with the amount on deposit. Try to make the loop appropriate to the website theme that you have picked. Use a function in your...

  • A web page with a form to compute the future value is displayed below.  The textbox is...

    A web page with a form to compute the future value is displayed below.  The textbox is named Loan, the listbox is named Rate and the radiobuttons belong to a Year group. (i) If the payment is computed by a JavaScript function named ComputePmt(), complete the ComputePmt function: Function ComputePmt() { } (ii).  If the form is processed by a JSP program named ComputePmt.jsp, complete the jsp program to compute the payment: <% %> Loan: 300000 Rate: 5% Select term: 15-year O...

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

  • Question: How can this code be rewritten without using array? Code in action here: After Inserting...

    Question: How can this code be rewritten without using array? Code in action here: After Inserting number: Full code is here: How would I rewrite this without using built in array or an array? C nked list ← ⓘ솔JSFiddle Ltd (GB) https:/JSfiddle.net/7m80w1c5/2/ .Most Visited @ Getting StartedのHP-See what's Hot Suggested Sites . Comments for The Ch web Slice Gallery C New Tab 60 D> Run 9 Update Fork Tidy Collaborate Embed v/ Settings <form> iddle Meta HTML Insert Number Here:<br>...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
Active Questions
ADVERTISEMENT