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
maksim [4K]
3 years ago
11

Write a function named countWords that reads in a line of text into a string variable, counts and returns the number of words in

the line. For simplicity assume that the line entered only has characters and spaces.
Computers and Technology
1 answer:
algol133 years ago
3 0

Answer:

function countWords(sentence) {

return sentence.match(/\S+/g).length;

}

const sentence = 'This sentence  has five  words ';

console.log(`"${sentence}" has ${countWords(sentence)} words` );

Explanation:

Regular expressions are a powerful way to tackle this. One obvious cornercase is that multiple spaces could occur. The regex doesn't care.

You might be interested in
50 POINTS How do you express yourself and your creativity through computer science?
Igoryamba

Answer:

1. I express myself through the designing, development and analysis of software and hardware used to solve problems in a variety of business, scientific and social contexts.

2. support the development of general reasoning, problem-solving and communication skills.

3. Through avoiding in repetious tasks and simplifying such works.

3 0
2 years ago
Create a poem about MS powerpoint presentation
iren2701 [21]
You could use poem generator online or see samples and change some words
5 0
3 years ago
17.
Radda [10]
Sorry to answer you so late but that would be truth because that is the first rule of science which is what thermodynamics depends in. 

The first law of thermodynamics is a type of law of conservation but with thermodynamics systems. 


So, in gogle I found this: "The law of conservation of energy states that the total energy of an isolated system is constant; energy can be transformed from one form to another, but cannot be created or destroyed."

Like I said, sorry to reply so late but I hope this helped! =)
3 0
2 years ago
What: A challenging question on this module's material.
Alekssandra [29.7K]

Need further information!!!

6 0
2 years ago
Content from online educational tools that is not protected under FERPA includes:
Dmitry [639]

Answer:

b. Any metadata that an online tool produces (for example, data about a student’s usage of a tool, or how much time it took them to take an assessment or look at a video) is not protected if it is not tied to any identifying information.

Explanation:

The content form educational tools that are online that is not protected under FERPA(Family Education Rights and Privacy Act) is any metadata that is produced by the online tool.That metadata can contain data about student's usage of a tool etc.

FERPA governs the access educational information and records by public entities.

4 0
3 years ago
Other questions:
  • 6. An art museum owns a large volume of works of art. Each work of art is described by an item code (identifier), title, type, a
    6·1 answer
  • What three components make up a film camera?
    14·2 answers
  • Which of the following commands is more recommended while creating a bot?
    9·1 answer
  • "Once a business operations analysis is completed and change needs to
    7·2 answers
  • From the following list choose all the tasks an operating system performs.
    5·2 answers
  • What does the -pwd switch do? how can you make dsadd bring up a prompt asking for the users password?
    10·1 answer
  • Why the internet is not considered a mass medium in Africa​
    13·2 answers
  • What's the answer plssss​
    10·1 answer
  • "To speed up magnetic hard drive performance , ___________ is often used. "
    15·1 answer
  • What will be displayed after this code segment is run?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!