Skip to main content
Commonmark migration
Source Link

#JavaScript ES6, 85 78 bytes

JavaScript ES6, 85 78 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)|a.some(v=>v[6]))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]

#JavaScript ES6, 85 78 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)|a.some(v=>v[6]))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]

JavaScript ES6, 85 78 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)|a.some(v=>v[6]))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]
deleted 7 characters in body
Source Link

#JavaScript ES6, 8585 78 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a|a.includessome("Pac-Man"v=>v[6]))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]

#JavaScript ES6, 85 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man"))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]

#JavaScript ES6, 85 78 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)|a.some(v=>v[6]))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]
added 2 characters in body
Source Link
Conor O'Brien
  • 40.2k
  • 3
  • 91
  • 180

#JavaScript ES6, 85 bytes

As an anonymous function a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man"))

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man"))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]

#JavaScript ES6, 85 bytes

As an anonymous function a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man"))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]

#JavaScript ES6, 85 bytes

As an anonymous function

a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man"))

Today I learned about this filter function. Fun!

15 bytes saved thanks to Neil.

Usage:

(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pac-Man"])
> ["Blinky","Inky","Pinky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))(["Pinky"])
> ["Blinky","Inky","Clyde"]
(a=>["Blinky","Inky","Pinky","Clyde"].filter(c=>!a.includes(c)||a.includes("Pac-Man")))([])
> ["Blinky","Inky","Pinky","Clyde"]
updated usage with latest code
Source Link
Neil
  • 177.3k
  • 12
  • 74
  • 281
Loading
added 18 characters in body
Source Link
Loading
Source Link
Loading