Remove removeVowels

This commit is contained in:
Angelos Chalaris
2020-04-16 11:12:44 +03:00
parent 81a78b2ba9
commit 7380db04b3
2 changed files with 0 additions and 29 deletions

View File

@ -1,18 +0,0 @@
---
title: removeVowels
tags: string,beginner
---
Returns all the vowels in a `str` replaced by `repl`.
Use `String.prototype.replace()` with a regexp to replace all vowels in `str`.
Omot `repl` to use a default value of `''`.
```js
const removeVowels = (str, repl = '') => str.replace(/[aeiou]/gi, repl);
```
```js
removeVowels("foobAr"); // "fbr"
removeVowels("foobAr","*"); // "f**b*r"
```

View File

@ -1,11 +0,0 @@
const {removeVowels} = require('./_30s.js');
test('removeVowels is a Function', () => {
expect(removeVowels).toBeInstanceOf(Function);
});
test('Removes vowels.', () => {
expect(removeVowels('foobAr')).toBe('fbr');
});
test('Replaces vowels.', () => {
expect(removeVowels('foobAr', '*')).toBe('f**b*r');
});