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
gogolik [260]
3 years ago
8

What is the value of the totalsString variable after the following code is executed? var totals = [141.95, 212.95, 411, 10.95];

totals[2] = 312.95; var totalsString = ""; for (var i = 0; i < totals.length; i++) { totalsString += totals[i] + "|"; }
Computers and Technology
1 answer:
Alex Ar [27]3 years ago
7 0
<h2>Answer:</h2>

141.95|212.95|312.95|10.95|

<h2>Explanation:</h2>

<em>Reformatting the code snippet and giving it line numbers;</em>

1.       var totals = [141.95, 212.95, 411, 10.95];

2.      totals[2] = 312.95;

3.      var totalsString = "";

4.      for (var i = 0; i < totals.length; i++) {

5.          totalsString += totals[i] + "|";

6.      }

Line 1 creates an array called totals with four elements.

     First element = totals[0] =141.95

     Second element = totals[1] = 212.95

     Third element = totals[2] = 411

     Fourth element = totals[3] = 10.95

Line 2 replaces the value of the third element <em>totals[2]</em> = 411 with 312.95.

     Therefore the array <em>totals = </em>[141.95, 212.95, 312.95, 10.95]

Line 3 creates an empty string called totalsString

Lines 4 - 6 create a for loop that cycles from i=0 to i<totals.length

       totals.length = 4 (which is the number of items in the array totals)

       This means that the loop cycles from i=0 to i<4

       During cycle 1 when i = 0, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[0] + "|"   //substitute the values

            totalsString = "" + 141.95 + "|"

            totalsString = 141.95|

       During cycle 2 when i = 1, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[1] + "|"   //substitute the values

            totalsString = "141.95|" + 212.95 + "|"

            totalsString = 141.95|212.95|

       During cycle 3 when i = 2, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[2] + "|"   //substitute the values

            totalsString = "141.95|212.95|" + 312.95 + "|"

            totalsString = 141.95|212.95|312.95|

       During cycle 4 when i = 3, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[3] + "|"   //substitute the values

            totalsString = "141.95|212.95|312.95|" + 10.95 + "|"

            totalsString = 141.95|212.95|312.95|10.95|

At the end of the execution, totalsString = 141.95|212.95|312.95|10.95|

You might be interested in
What does "CYBER-COCKROACH" mean??
katrin2010 [14]

Answer:

The cyber cockroach is the presented external anatomy of a cockroach, with labeled views of photographs from diverse angles in place of diagrams. The cyber cockroach can be navigated around the head, thorax and abdomen with possible close up views of the legs and the images are downloadable

Cyber cockroach is a useful tool for the study of insects of the Blattodea order

Explanation:

3 0
3 years ago
This type of software can be described as end user software and is used to accomplish a variety of tasks. communications system
dezoksy [38]
This answer to this question is System
3 0
3 years ago
A member of your team wants to add some funny pictures that he took during the company party to lighten the mood at the beginnin
san4es73 [151]
No, because they are personal photos taken of an event that was not copyrighted. If the event was copyrighted then they would but if not then no.
7 0
3 years ago
Read 2 more answers
(tco 8) when asp.net receives a request for an application that uses forms-based authentication from a user who hasn't been auth
leonid [27]
Hi,

This what you are looking for: "records incorrect prompt"

Hope this helps.
r3t40
7 0
3 years ago
Misconfiguration of wireless parameters is one of several common problems in wireless networks. For example, if a wireless clien
Vikki [24]

Answer:

If a wireless client was only capable of WPA encryption, the client would be able to connect by LAN1 or PoE adapter´s LAN port ethernet network to void misconfiguration of wireless parameters which is one of several common problems in wireless networks.

Explanation:

The device that enables a wireless network on an office, building or any specific zone is called WLAN or access point. It switches or hubs to a wired router by an E

An access point connects to a wired router, switches or hubs using an ethernet cable, and delivers a Wi-Fi signal to the aimed area for downstream service and it also allows destop computers and other wired devices to access by LAN1 port or adapters.

5 0
3 years ago
Other questions:
  • Perhaps programs used for business purposes ought to conform to higher standards of quality than games. With respect to software
    7·1 answer
  • CHANGE POSITION OF SONG Enter song's current position: Enter new position for song: "Peg" moved to position 3 JAMZ PLAYLIST MENU
    9·1 answer
  • HELP ASAP????? please
    5·2 answers
  • A search engine that crawls uses
    7·1 answer
  • How many words fit on a double-spaced page?
    11·1 answer
  • Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and ca
    7·1 answer
  • In this lab, you will create a programmer-defined class and then use it in a Java program. The program should create two Rectang
    14·1 answer
  • A(n) ____________________ is a hardware device or software utility designed to intercept and prevent unauthorized access to a co
    6·1 answer
  • Select the item that best represents technology transfer?
    8·1 answer
  • When all the system testing and bugs correction has done, the software product will be delivered to the user for __________.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!