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
What protein is found in hair and nails
Yuliya22 [10]

Keratin is found in both hair and nails.

Hope this helps!

4 0
4 years ago
Read 2 more answers
Characteristics of a deterministic system<br>​
Fiesta28 [93]

Explanation:

deterministic system is a involved in development of future states of the system is called deterministic determinstic system.

3 0
3 years ago
Which date formats are allowed in Excel for February 14, 2018? Check all that apply.
bonufazy [111]
The answers are 3,5, and 6
4 0
3 years ago
Your supervisor informs you that she would like to roll-out a VPN solution for your organization. Assume this is a small to mid-
katen-ka-za [31]

Answer:

1) The VPN Client

2) VPN Server

Explanation:

The first VPN solution includes following elements.

1) The VPN Client: In our solution we required a VPN client.

2) VPN Server: The server of VPN includes following elements:

a) IP addressing

b) Tunnel and authentication

c) Remote access policy

d) Filtering

3) The software and hardware includes:

a) VPN enabled optamized router

b) VPN enabled firewall

So, according to first VPN solution we required vpn client as well as the vpn server.

The second solution include the vpn client as well as the vpn server. Here vpn client as well as the vpn

server having very limited functionality.

5 0
3 years ago
What are the advantages of computer​
SOVA2 [1]
Well personally it saves so much time!!

It connects you to the internet, you can FaceTime friends and family and search up anything you need or want and get the answer. It can be used for organization for those who like to keep things neat or to put those important documents in! You also have the ability to create a website and start a business and make a great mount of cash. I mean I can go on and on about the benefits but you get the point
7 0
3 years ago
Other questions:
  • A(n) _______________ supplies one of the most critical aspects of docking stations, but in a smaller, more portable format: supp
    15·1 answer
  • To display or distribute information from a database, programmers or database administrators create ___ .
    12·1 answer
  • 3.What is deep focus, and when is it a good choice for a scene?
    8·1 answer
  • How do you reduce computer screen flicker
    11·1 answer
  • What allows users to connect via the Internet to its private network?
    11·2 answers
  • 5.2
    8·1 answer
  • (20points)
    6·1 answer
  • For C++ ONLY please,
    14·1 answer
  • Keli is unable to find a shape that meets her needs. Which feature in Power Point should she use to create shapes that are compl
    6·1 answer
  • Create a paper of at least 1,800 words describing the situation you selected and explaining the logic that would support an arra
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!