Advertisement
bebo231312312321

Untitled

Apr 2nd, 2023
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function easterEggs(input){
  2. let string = input.shift()
  3. let path = /(@{1,}|#{1,})(?<color>[a-z]{3,})(@{1,}|#{1,})[^A-Za-z0-9]+(\/{1,})(?<digit>[\d]+)\4/g
  4.  
  5. let matches = string.matchAll(path)
  6. if(matches){
  7.    for(let match of matches) {
  8. console.log(`You found ${match.groups.digit} ${match.groups.color} eggs!`)
  9.  
  10.    }
  11. }
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement