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 tab automatically becomes available after inserting a text box? Drawing Tools Insert Text Box Tools Shape Tools
In-s [12.5K]

Answer:

insert text box

Explanation:

6 0
3 years ago
Read 2 more answers
Where do you place the logical test argument in an IF function formula?
Inessa [10]

Answer:

The first argument listed after IF

Explanation:

When the two variables are listed next to each other, Excel will find and calculate the correlation between them.

8 0
3 years ago
Read 2 more answers
When you enable user access control (uac)
SVEN [57.7K]
The UAC is on by default. So, you don't need to turn it on unless someone else turned it off.

The UAC has four modes.

The lowest mode is the off position. If the UAC is off, no UAC prompt will pop up when doing administrative tasks.

6 0
3 years ago
To insert a footnote in a document, a user would navigate to the _____ tab.
Pachacha [2.7K]

Answer

References tab.

Explanation

In MS word documents, you can add footnotes and endnotes by;

• Clicking the area to add a footnote

• Clicking references, then insert Footnote. The word program will insert a reference mark in the text and will add the footnote mark at the bottom of the page

• Type a footnote text.

Hope this Helps!

3 0
3 years ago
Read 2 more answers
What is a list of data organized for easy access?
ozzi

Answer:

An Array

Explanation:

Array and Object is a good use for storing data and accessing it

6 0
1 year ago
Other questions:
  • Over the past week, every time Larry has started his computer, he has noticed that the time is not correct. Larry didn’t conside
    13·2 answers
  • Three variables, x, y and z, supposedly hold strings of digits, suitable for converting to integers. Write code that converts th
    7·1 answer
  • What is Mainframe computer​
    15·1 answer
  • Complete the below method, isPalindrome(), that takes in a String and returns a boolean. The boolean should be true if the Strin
    7·1 answer
  • Why might you receive a tax refund from the irs
    6·1 answer
  • A customer is looking for a storage archival solution for 1,000 TB of data. The customer requires that the solution be durable a
    9·1 answer
  • Predict the output
    7·1 answer
  • SmartArt is a Microsoft Office tool for creating what?
    11·2 answers
  • Make The PYTHON Code<br><br> print first 3 character of a string - given "Seattle" expected "Sea"
    14·1 answer
  • WILL GIVE BRAILIEST
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!