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
spin [16.1K]
3 years ago
8

What is displayed in the alert dialog box after the following code is executed? var scores = [70, 20, 35, 15]; scores[scores.len

gth] = 40; alert("The scores array: " + scores);
Computers and Technology
1 answer:
kvv77 [185]3 years ago
4 0

Answer:

The scores array: 70,20,35,15,40

Explanation:

I will explain the code line by line:

var scores = [70, 20, 35, 15];  

The above statement declares and assigns values to an array named scores

scores[scores.length] = 40;  

The above statement uses length to set the length of the scores array. It sets the last element of the scores array to 40. So this means 40 is set as the last element of scores.

scores.length returns the length of the scores array i.e. 4 as there are 4 elements in scores array 70,20,35,15

So the statement becomes:

scores[4] = 40;

This assigns value 40 to the 4th index of the scores array. Do not confuse 4th index with 4th element of the array because array element location starts from 0. So scores[4] does not mean 4th element but scores[4] means 4th index position of scores array. This makes 5th element of scores. So set the element 40 as 5th element at 4th index of scores.

alert("The scores array: " + scores);

This displays an alert box with the following message:

The scores array: 70,20,35,15,40

You might be interested in
Using selection sort, how many times longer will sorting a list of 40 elements take compared to a list of 5 elements
Hoochie [10]

It will take 8 times more time to sort a 40-element list compared to the time spent on a 5-element list.

We can arrive at this answer as follows:

  • We can see that if we divide a group of 40 elements into groups containing 5 elements, we will have 8 groups.
  • In this case, the time it would take to sort the list of one group of 5 elements would be repeated 8 times so that we could sort all the groups and their elements.

Another way to do this is to divide the number 40 by 5. We would have the number 8 as a result, which indicates that we would need 8 times more time to sort a list of 40 elements, compared to a list of 5 elements.

You can get more information about lists at this link:

brainly.com/question/4757050

5 0
3 years ago
Write an HTML document which contains two text fields, a button, and a div. The first text field should be labeled “Temperature”
disa [49]

Answer:

I created a jsfiddle for this: https://jsfiddle.net/tonb/o7uv4cdm/26/

Explanation:

see jsfiddle.

The usual html and body tags are omitted for simplicity. For your stand-alone page you'll have to put them in, as well as additional tags for your inline scripting.

5 0
4 years ago
Discuss the three different software applications of Microsoft that you have leaned in this class (Word, PowerPoint and Excel).
sammy [17]

Answer:

ok!

Explanation:

Word is more for writing documents and letters, PowerPoint is used for presentations for a class work etc. Excel is a handy software that can be used to store and organize many data sets. Using its features and formulas, you can also use the tool to make sense of your data. For example, you could use a spreadsheet to track data and automatically see sums averages and totals.

7 0
3 years ago
Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. A divisor is a numb
Andre45 [30]
For divisor in divisors (number):
answer += 1

return answer
7 0
3 years ago
How do you whitelist or turn off ad blocker for brainly?
sweet-ann [11.9K]

Answer:

rightclick and it should give you the option

Explanation:

sddas

6 0
3 years ago
Read 2 more answers
Other questions:
  • Which method of deleting files can be used in windows xp and vista?
    12·1 answer
  • If someone receives a shock, or a piece of equipment is throwing sparks or arcing you should try to pull them away from the sour
    7·1 answer
  • What does a contain after the following code runs?int[] a = {1, 3, 7, 0, 0, 0};int size = 3, capacity = 6, value = 5;int pos = 0
    10·1 answer
  • ith reference to McCall's quality modle , what are the three important aspects of a software product ?
    7·1 answer
  • A _____ describes two or more computers connected to each other.
    6·2 answers
  • When the Hyper-V role is added to a Windows Server 2016 server, the hypervisor creates the individual environments, each of whic
    5·1 answer
  • The school tie is made from a piece of fabric measuring 135cm long by 9cm wide. The fabric is supplied in a roll that is 90mm wi
    14·1 answer
  • What are the five generations of computers?​
    13·1 answer
  • How was kapilvastu named​
    11·1 answer
  • What type is the combination of an integer and a string
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!