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
Stores of data that are so large or complex that it is difficult to process them using traditional data base management applicat
OverLord2011 [107]

Answer: ....

Big Data

Explanation:

Big Data Technology can be defined as a Software-Utility that is designed to Extract,Analyse and  Process  the information from an extremely complex and large data sets which the Traditional Data Processing Software could never deal with. Big data is a field that treats ways to analyze, systematically extract information from, or otherwise deal with data sets that are too large or complex to be dealt with by traditional data-processing application software.

Predictive analytics assists enterprises in identifying future opportunities and likely risks by distinguishing specific patterns over the historical data. In general, prescriptive analytics is a predictive analytics which prescribes one or more courses of actions and shows the likely outcome/influence of each action.

6 0
3 years ago
Fill in the blank; "As well as their traditional role of computing data, computers are also extensively used for..."
Vikki [24]

Answer:

Information output and information storage

Explanation:

Output in the form of images, audio, printed on paper, video, 3D models, etc

Storage - saving information internally on hard drive and externally (HDD, SSD, RAID system, etc

6 0
3 years ago
P2p networks are most commonly used in home networks. <br> a. True <br> b. False
postnew [5]
<span>The statement that P2P networks are most commonly used in home networks is true. 
</span>P2P stands for peer-to-peer communication network. It is an example of local administration. <span> Two or more PCs share files and access to devices such as printers without requiring a separate server computer or server software with P2P type of network.</span>
6 0
3 years ago
What are these receivers called?
AlexFokin [52]

Answer: Cell site / Base station

Explanation:

A mobile network also referred to as the cellular network is refered to as the radio network which is distributed over the land areas which are refered to as the cells.

We should note that each is served by at least one fixed-location transceiver, which is called the cell site or the base station.

4 0
2 years ago
What is a spec sheet?
Artist 52 [7]
spec sheet is a document that summarizes the performance and other technical characteristics of a product, machine or component.
8 0
2 years ago
Other questions:
  • Barr the Bear has started a business to sell fish to Poe and his fellow penguins. The penguin customers submit many fish orders,
    12·1 answer
  • Why are computer programs so much longer now than they were in the late 1980?
    8·1 answer
  • An example of what you can post that shows kindness to other
    15·1 answer
  • Describe the benefits and drawback of using virtualisation on a single machine and also in a cluster environment
    10·1 answer
  • (Help please I don't know what to choose because it's both text and email but I can only pick one. HELP!!!!!!!!!!)
    6·2 answers
  • Brainliest for whoever adds me on snap<br> gianavaughn007
    15·2 answers
  • Why are mobile phone called cell phones?​
    13·1 answer
  • Raul needs to ensure that when users enter an order into the tblOrders, the shipping date is at least two days after
    9·2 answers
  • 1. Insert a Header that has the following in excel​
    14·1 answer
  • If we need to manage a contiguous range of memory, handling requests to allocate various sized chunks, and later make those chun
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!