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
shepuryov [24]
3 years ago
8

Implement the function calcWordFrequencies() that uses a single prompt to read a list of words (separated by spaces). Then, the

function outputs those words and their frequencies to the console.
Ex: If the prompt input is:

hey hi Mark hi mark
the console output is:

hey 1
hi 2
Mark 1
hi 2
mark 1
Computers and Technology
1 answer:
Novosadov [1.4K]3 years ago
5 0

Answer:

JavaScript code is given below

Explanation:

function calcWordFrequencies() {

   var words = prompt("Enter the sentence below").split(" ");

   var unique_words = [], freqencies = [], count = 0;

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

       var found = false;

       for (var j = 0; j < count; j++) {

           if (words[i] === unique_words[j]) {

               freqencies[j] = freqencies[j] + 1;

               found = true;

           }

       }

       if (!found) {

           unique_words[count] = words[i];

           freqencies[count] = 1;

           count++;

       }

   }

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

       var result = 0;

       for (var j = 0; j < count; j++) {

           if (words[i] === unique_words[j]) {

               result = freqencies[j];

               break;

           }

       }

       console.log(words[i] + " " + result);

   }

}

You might be interested in
In ______ each station is assigned a code; using a special coding scheme, stations send data over the entire bandwidth of the ch
Viktor [21]

Answer:

CDMA is sa station.

Explanation:

CDMA is basically a Code Division Multiple Access .It is assgned code that facilitates the signals or special coding scheme.It optimizes the use of bandwidth, It is used in a UHF and send data over entire bandwidth of channel.It send data without sharing of capacity of channel. Its ranges is between 800 MHz and 1.9 GHz

4 0
3 years ago
Go follow me plz i would appreciate it
aleksandr82 [10.1K]
Hejdjxuxudjjdjdbdbdbd
6 0
2 years ago
Read 2 more answers
Which of the following is not an Operating System? (1 point)Windows
kobusy [5.1K]
The answers of the following are:

1.  The answer is Linux. It is not an Operating System.
2. Windows XP 2000 and Windows XP Home Edition have the same interface design. 
3. Linux is the operating systems which is considered to be open source.
4. Mac OS is an operating system which is considered to be the most popular with graphic and multimedia designers
5. The software programis the number and variety of programs available for a particular operating system.
4 0
3 years ago
When an interviewer asks “Tell me about yourself”, you should tell them about your childhood past.
Butoxors [25]

Answer: Nooo! Dont!

Explanation:That is a bad idea!

4 0
3 years ago
Read 2 more answers
Provide a brief, high-level description of how the Internet’s connection-oriented service provides reliable transport.
mario62 [17]

Answer:

  Connection-oriented is the method which is implemented in the transport and data link layer. It is basically depend upon the physical connection in the network system.

Transmission control protocol (TCP) is the connection oriented and user datagram protocol (UDP) is the connection less network transport layer. The TCP and UDP both are operate in the internet protocol (IP).

It basically require connection and it can be establish before sending data. This is also known as reliable network connection service. The connection oriented service establish connection between the different connection terminal before sending any data or information. It can easily handle traffic efficiently.

7 0
3 years ago
Other questions:
  • In Python, what kind of error is returned by the following code? (e.g. NameError, ValueError, IOError, etc.) def my_func(n1, n2)
    8·1 answer
  • The command to delete all the files that have filenames that starts with letter c or c and ends with a letter z or z is
    15·1 answer
  • The man-in-the-middle attack<br> means what
    7·1 answer
  • Is spread spectrum transmission done for security reasons in commercial WLANs?
    13·1 answer
  • A presentation has bullet points that move. The presenter wants to use these bullet points in several other places in the presen
    6·1 answer
  • When installing EMT conduit that will be exposed to wet conditions, _______ fittings should be used.
    5·2 answers
  • When I click on someone who asked a question and i want to see there answer it is always blurred and when I asked a question I c
    8·1 answer
  • A sum amounts to ₹2400 at 15% simple interest per annum after 4 years fond the sum.​
    9·1 answer
  • GIVING BRAINLIEST
    15·1 answer
  • When light hits an opaque object it will be _______________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!