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
Consider Ron’s budget. How much money does Ron have left over each month?
vladimir1956 [14]
What is Ron’s budget?
4 0
3 years ago
Read 2 more answers
Which of the following is not one of the most common causes of electrical accidents ?
defon

Cords too long. The cords may be a tripping hazard, but no electrical accident will occur because of it.

7 0
4 years ago
Read 2 more answers
3.4 lesson practice
Strike441 [17]

Answer:

The answer is A. Second Half of the month.

Explanation:

If Im reffering right to the source. So If you doing Chapter 3 Comp. Science. Than this is right.

7 0
3 years ago
Read 2 more answers
HELP ASAP- YOU GET BRAINLIEST!!
agasfer [191]

Answer:

BLOb

Explanation:

Binary Large Objects (BLOb) data is capable of storing data in the form of images, audio, and video clips.

3 0
4 years ago
Why does a HTML seen to work even when its broken? why does the code sometimes turn pink?
OverLord2011 [107]

the reason HTML seems to work even if it has syntax errors is due to browser having built in ways to parse the code meaning it will still show but most likely look way different then you would want.

the code may turn pink due to syntax errors

5 0
3 years ago
Other questions:
  • Which item is essential to know before sketching a navigation menu flowchart
    15·2 answers
  • It is not possible to use keywords to search for themes
    5·1 answer
  • How does soil lose its value? A.When the top soil is stripped by wind or water B.When the bedrock is damaged by animals C.When w
    15·1 answer
  • Use the variables k and total to write a while loop that computes the sum of the squares of the first 50 counting numbers, and a
    10·1 answer
  • Do you think that feedly will help you create an effective personal online learning environment? Why or why not?
    15·1 answer
  • To improve at keyboarding, it is a good idea to master frequently typed words.
    14·2 answers
  • W t f is a ground fault circuit interrupter?
    6·2 answers
  • To all paladins players out there!!!!!
    14·1 answer
  • 4.2 Code Practice: Question 2​
    14·1 answer
  • Becuase privacy is personal customers, where should your data privacy efforts align?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!