Advertisement
bebo231312312321

Untitled

Apr 2nd, 2023
125
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 = /[@#]+(?<color>[a-z]{3,})[@#]+[^A-Za-z0-9]*[\/]+(?<digit>[\d]+)[\/]+/g
  4.  
  5.     let matches = string.matchAll(path)
  6.     if (matches) {
  7.         for (let match of matches) {
  8.             if (match.groups.digit!==undefined && match.groups.color!==undefined) {
  9.                 console.log(`You found ${match.groups.digit} ${match.groups.color} eggs!`)
  10.             }
  11.         }
  12.     }
  13.  
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement