-
Code const countVowel=s=>(s.match(/[aeiou]/ig) || []).length
Test Cases // Since Node 10, we're using Mocha. // You can use `chai` for assertions. const chai = require("chai"); const assert = chai.assert; // Uncomment the following line to disable truncating failure messages for deep equals, do: // chai.config.truncateThreshold = 0; // Since Node 12, we no longer include assertions from our deprecated custom test framework by default. // Uncomment the following to use the old assertions: // const Test = require("@codewars/test-compat"); describe("Solution", function() { it("should test for something", function() { // Test.assertEquals(1 + 1, 2); assert.strictEqual(countVowel("Vowels at sentence"), 6); assert.strictEqual(countVowel("Autronica is a leading innovator, manufacturer and supplier of fire and gas safety worldwide."), 33); }); });
Output:
-
Code //countVowelAtWord=s=>s.replace(!/[aeiou]/ig,``).lengthconst countVowel=s=>s.replace(/[^aeiou]/ig,'').length- const countVowel=s=>(s.match(/[aeiou]/ig) || []).length
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}