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
zheka24 [161]
3 years ago
6

Function _one(array)

Computers and Technology
1 answer:
dsp733 years ago
6 0

Answer:

function removeRepeaters(list){

   var goodList = [], badList = {}, used = {}, n;

   // ensure that the argument is indeed an array

   if(!Array.isArray(list)){

        throw "removeRepeaters: Expecting one argument of type Array";

   }

   // loop through the array and take note of any duplicates

   for(n in list) used[list[n]] == true ? badList[list[n]] = true : used[list[n]] = true;

   // now loop through again, and assemble a list of non-duplicates

   for(n in list) if(badList[list[n]] == undefined) goodList[] = list[n];

   return goodList;

}

Explanation:

I assume you're familiar with trinary operators, but just in case, that's what's happening in this first for loop:

for(n in list) used[list[n]] == true ? badList[list[n]] = true : used[list[n]] = true;

this is the same as saying:

for(n in list){

   if(used[list[n]] == true){

       badList[list[n]] = true;

   } else {

       used[list[n]] = true;

   }

}

This loop flags all of the values in the list that are duplicated.  Note that both "badList" and "used" are declared as objects instead of arrays.  This allows us to compare keys in them with an == operator, even if they're not defined, making it a convenient way to flag things.

Note that I haven't tested it, so I may have overlooked something.  I suggest testing it before handing it in.

You might be interested in
Good information is characterized by certain properties. Explain how you understand these characteristtics of good information.
Sedbober [7]

Answer:

here is your ans

Explanation:

Characteristics of good quality information can be defined as an acronym ACCURATE. These characteristics are interrelated; focus on one automatically leads to focus on other.

Accurate

Information should be fair and free from bias. It should not have any arithmetical and grammatical errors. Information comes directly or in written form likely to be more reliable than it comes from indirectly (from hands to hands) or verbally which can be later retracted.

Complete

Accuracy of information is just not enough. It should also be complete which means facts and figures should not be missing or concealed. Telling the truth but not wholly is of no use.

Cost-beneficial

Information should be analysed for its benefits against the cost of obtaining it. It business context, it is not worthwhile to spend money on information that even cannot recover its costs leading to loss each time that information is obtained. In other contexts, such as hospitals it would be useful to get information even it has no financial benefits due to the nature of the business and expectations of society from it.

User-targeted

Information should be communicated in the style, format, detail and complexity which address the needs of users of the information. Example senior managers need brief reports which enable them to understand the position and performance of the business at a glance, while operational managers need detailed information which enable them to make day to day decisions.

Relevant

Information should be communicated to the right person. It means person which has some control over decisions expected to come out from obtaining the information.

Authoritative

Information should come from reliable source. It depends on qualifications and experience and past performance of the person communicating the information.

Timely

Information should be communicated in time so that receiver of the information has enough time to decide appropriate actions based on the information received. Information which communicates details of the past events earlier in time is of less importance than recently issued information like newspapers. What is timely information depends on situation to situation. Selection of appropriate channel of communication is key skill to achieve.

Easy to Use

Information should be understandable to the users. Style, sentence structure and jargons should be used keeping the receiver in mind. If report is targeted to new-comer in the field, then it should explain technical jargons used in the report.

4 0
2 years ago
What is the term for a male reproductive cell?​
prohojiy [21]

Answer:

I believe it is a sperm cell.

Explanation:

Not a sex cell because that can apply to both female and male reproduction.

4 0
3 years ago
Help me with this please
Ymorist [56]

Answer:

q1 chees

q2 web and digital continant

Explanation:

because haaa haaa haa dhum

7 0
2 years ago
Consider the following declaration.int[] alpha = new int[3];Which of the following input statements correctly input values into
stepladder [879]

Answer:

Option (2) i.e., Only (ii) is the correct option to the following question.

Explanation:

Here, in the following code that is written in the Java Programming Language in which they set integer data type array variable "alpha" and set its index to 3 through "new" keyword then, we get input from the user in the index 0 then, we get input from the user in the index 1 then, again we repeat this step for index 2. So, that's why the following option is correct.

Option 1 is wrong because in this option the user input only in the index 0 and this is also the wrong way to insert value in the array variable.

5 0
3 years ago
List the seven basic internal components found in a computer tower
egoroff_w [7]
1. Motherboard (you plug all other components to it)
2. Processor (CPU)
3. Memory (RAM)
4. Graphics card
5. Sound card (sometimes integrated with motherboard)
6. Hard Disk Drive (HDD)
7. Power supply unit
6 0
3 years ago
Read 2 more answers
Other questions:
  • What type of data visual would you use to illustrate trends over time? Gantt chart Bar graph Line chart Scatter diagrams
    5·1 answer
  • Radiation requires a heated liquid to transfer energy. Please select the best answer from the choices provided T F
    10·2 answers
  • You can use ???? a to test tread wear on your tires
    14·2 answers
  • What is a major way that a consumer can protect himself/herself when getting a credit card? A) Making sure that they get a very
    8·1 answer
  • Interactive television with video-on-demand capabilities changes how people watch television and how consumers access the Intern
    8·1 answer
  • Digital communications describes a process in which two or more computers or devices transfer ____, ____ and instructions.
    12·1 answer
  • Explain motherboard in detail
    14·2 answers
  • What is the gear ratio?
    12·1 answer
  • Kyra is teaching a photography class. She would like her students to share photos. She would also like the students to be able t
    6·1 answer
  • Point to ______ of a cell to fill the cell to the right or down.
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!