js-mentorship-razvan / javascript

Javascript study notes
GNU General Public License v3.0
22 stars 2 forks source link

Build a word counter function #389

Closed odv closed 4 years ago

odv commented 4 years ago

Function should accept a string and return back two strings:

Character count: x where x is the actual number of characters in a string

Word count: x where x is the actual number of words in a string

RazvanBugoi commented 4 years ago
function wordCounter (input) {
    console.log(`Character count is ${input.length}.`);
    console.log(`Word count is ${input.split(" ").length}.`);
}
RazvanBugoi commented 4 years ago
function wordCounter3 (input) {
    console.log(`Character count is ${input.length}. \nWord count is ${input.split(" ").length}.`);
}