-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path139_unscrambled_eggs.js
More file actions
33 lines (24 loc) · 1.4 KB
/
139_unscrambled_eggs.js
File metadata and controls
33 lines (24 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Unscramble the eggs.
// The string given to your function has had an "egg" inserted directly after each consonant. You need to return the string before it became eggcoded.
// Example
// unscrambleEggs("Beggegeggineggneggeregg") => "Beginner"
// // "B---eg---in---n---er---"
// Kata is supposed to be for beginners to practice reggular eggspressions, so commenting would be appreciated.
//P:Some string will be given to us. Will it be in the form of an array? Will it ever be a number that has to be changed into a string?
//R:Returning said string without the word "egg" in it.
//E:
// let string = "Speggetegghetti" // => Spaghetti
// let string = "Reggunneregg" // => Runner
// let string = "Deggressegg" // => Dress
// let string = "Eggxpleggaineregg" // => Explainer
// let string = "Heggammeregg" // => Hammer
// let string = "Preggacteeggicegg" // => Practice
// let string = "Eggducatteggion" // => Education
// let string = "Eggtereggnet" // => Internet
// let string = "Leggbrarieggan" // => Librarian
// let string = "Eggniveggstigeggator" // => Investigator
// let string = "Egglecteggroniceggs" // => Electronics
// let string = "Eggxeggclusieggegg" // => Exclusive
// let string = "Eggrassegghoppegging" // => Grasshopping
const unscrambleEggs = (string) => string.replaceAll('egg','')
console.log(unscrambleEggs(string))