1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kobusy [5.1K]
3 years ago
8

What is displayed in the alert dialog box after the following code is executed? var items = 3; for (var i = 1; i <= items; i+

+) { var result = 1; for (var j = i; j >= 1; j--) { result *= j; } alert("The factorial of " + i + " = " + result); }
Computers and Technology
1 answer:
LenKa [72]3 years ago
4 0

Answer:

The factorial of 3=6

Explanation:

Following are the description of the given question

  • This is JavaScript code .Here items are the variable that are holding the integer value "3".
  • After that there is 2 loop are iterating one is outer and one inner loop.
  • When i=1 1<=3 the condition of outer loop is true  the control moves the inner loop .
  • In the inner loop there is variable result that is initialized by 1 Now checking the condition of inner loop j=i i.e j=1 1>=1 condition of inner loop is true it executed the statement inside the inner loop  so result =1 .Now we increment the value of i of the outer loop.
  • i=2 2<=3 the condition of outer loop is true  the control moves the inner loop .
  • In the inner loop there is variable result that is initialized by 1 Now checking the condition of inner loop j=i i.e j=2 2>=1 condition of inner loop is true it executed the statement inside the inner loop  so result =2 .Now we increment the value of i of the outer loop.
  • Now i=3 3<=3 the condition of outer loop is true  the control moves the inner loop .
  • In the inner loop there is variable result that is initialized by 1 Now checking the condition of inner loop j=i i.e j=3 3>=1 condition of inner loop is true it executed the statement inside the inner loop  so result =6 .Now we increment the value of i of the outer loop.
  • i=4 4<=3 the condition of outer loop is false  the control moves from  the outer loop.
  • It print The factorial of 3=6

You might be interested in
What is required when opening a checking account?
Brums [2.3K]
A, because if not, there is nothing to say it exsists
8 0
3 years ago
Read 2 more answers
The iteration variable begins counting with which number?<br> O 0<br> O 1<br> O 10<br> O 0 or 1
bonufazy [111]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The iteration variable begins counting with 0 or 1.

As you know the iteration mostly done in the looping. For example, for loop and foreach loop and while loop, etc.

It depends upon you that from where you can begin the counting. You can begin counting either from zero or from one.

For example: this program counts 0 to 9.

<em>int total=0;</em>

<em>for(int i=0; i>10;i++)</em>

<em>{</em>

<em>total = total+i;</em>

<em>}</em>

Let's suppose, if you want to begin counting from 1, then the loop should look like below:

<em>int total=0;</em>

<em>for(int i=1; i>10;i++)</em>

<em>{</em>

<em>total = total+i;</em>

<em>}</em>

7 0
3 years ago
Which code segment will guarantee that the robot makes it to the grey square without hitting a wall or a barrier (black square)
klemol [59]

Answer:

function solveMaze(){ moveForward(); moveForward(); rotateRight(); while(canMove("forward")){ moveForward(); } rotateLeft(); moveForward(); }

Explanation:

took the test

4 0
2 years ago
What is the minimum number of different résumé formats that an individual should have prepared?
Degger [83]

Answer:

The minimum number of different resumes formats that an individual should have prepared is b. 2 The first should be a condensed format. A good resume should only require one page. However, when things get too cramped in a single page, a two-page format can be used. A two-page format can be used to provide more details about yourself.

Explanation:

5 0
3 years ago
Explain how you would center the title" ESAYSURF" across the columns use the spread sheet
kari74 [83]
After you type the words in. press the column its in an highlight it to whatever your instructions say then press merge and center.
6 0
4 years ago
Other questions:
  • A technician, joe, has replaced a faulty 500 gb hard drive in a pc system with a 1 tb hard drive. however, after the replacement
    10·1 answer
  • Recall that through either photographic or computer technology, researchers can make a composite (or "averaged") face out of any
    11·1 answer
  • An extranet is like an intranet except that it allows company employees access to corporate Web sites from the ______
    13·1 answer
  • In a car crash, wearing a seat belt __________________.
    5·2 answers
  • 2. Feet to Inches One foot equals 12 inches. Design a function named feetToInches that accepts a number of feet as an argument,
    8·1 answer
  • 2. An evil twin attack that broadcasts a legitimate SSID for an unauthorized network is an example of what category of threat? A
    9·1 answer
  • Image
    9·1 answer
  • Which of the following is a precaution that helps to protect you from electric shock when working with electric power tools?
    7·2 answers
  • Discuss about the main frame computer​
    9·1 answer
  • Any song recommendations, pls dont say 6ix9ine or lil pump
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!