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
Which is the base class in the following statement? class car : public vehicle
tatiyna

The base class in the following statements is the vehicle class.

<h3>What is a base class?</h3>

A base class is also known as a parent class.

A parent class is the existing class from which the other classes are determined and properties are inherited.

The class car is the child class. The child class inherit the properties of the parent class or the base class.

Therefore, the base class is the vehicle class.

learn more on class here; brainly.com/question/14293976

#SPJ11

8 0
2 years ago
Why should you open your door with your right hand when parked on a right-side curb?
meriva

Answer:

B. So that you will be forced to look behind the car for an approaching bicyclist.

Explanation:

The main reason for opening with your right hand in this scenario is so you can look behind you for a bicyclist, etc. It's a good practice as you never know if someone is behind you or of the likes. Many people usually open the door with their left hand. The problem with this is that they're not forced to look behind them and can be oblivious to people, bicyclists, etc. behind them.

<u>Hope this helps and have a nice day!</u>

5 0
4 years ago
_______ is the type of vision useful in sensing motion and objects outside normal vision.
Likurg_2 [28]

The answer is peripheral vision, also known as side vision.

3 0
3 years ago
Which CGI technology uses the Java programming language to process data received from a Web form?This task contains the radio bu
Rufina [12.5K]

Answer:

B. JSP

Explanation:

CGI, or Common Gateway Interface, is a specification for transferring information between a World Wide Web server and a CGI program.

JSP (Java Server Pages)  is a universal CGI technology that uses the Java interpreter. JSP is used for developing Webpages that supports dynamic content.

4 0
3 years ago
Some applications required advanced storage solutions are available to provide fault tolerance and high performance.
katen-ka-za [31]
A. True

This is because not all applications can run with low/small storage.
3 0
3 years ago
Other questions:
  • Write a java program called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the numbe
    6·1 answer
  • A digital device Select one: a. uses electricity to run it. b. uses symbolic representations of data in the form of code. c. req
    7·1 answer
  • As Assembly language code runs on a CPU invoking functions and using the stack, it is clear that CPU registers are
    8·1 answer
  • The following are the CPU and I/O behavior of three processes, timings in seconds.
    9·1 answer
  • What is the output of the following code snippet? int s1 = 20; if (s1 &lt;= 20) { System.out.print("1"); } if (s1 &lt;= 40) { Sy
    6·1 answer
  • What in the world is this for and how do you use it
    8·2 answers
  • What information is used in a communication between two system
    10·1 answer
  • Jenny has entered data about models of laptops from company A and company B in a worksheet. She enters model numbers of laptops
    10·1 answer
  • What is the full form of cpu​
    11·2 answers
  • ¿Cuántos motores tiene el Toyota Prius y que características poseen?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!