Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

2 of 4
Added explanantion, improved answer
emanresu A
  • 46.2k
  • 5
  • 111
  • 257

JavaScript (Node.js), (削除) 99 (削除ここまで) 95 bytes

x=>y=>!'e to for si'.split` `.filter(m=>!m.split``.map(k=>(x+y).includes(k)).includes(true))[0]

Try it online!

Uses xash's idea from his J answer.

Returns false for yes and true for no (counterintuitive I know, deal with it). Uses currying syntax - (x)(y).

Explanation:

x=> //declare function
 y=> //declare function 2
 ! // necessary for consistent result
 'e to for si' //see xash's J answer
 .split` ` // to array
 .filter( //keep value only if following true
 m=> //function with value m
 ! //if following is false
 m.split`` //m into array of letters
 .map( //replace each with
 k=> //function of k
 (x+y).includes(k) //Map to two words together including k
 ).includes(true) //if includes true (input contains one of word
 ) // array now has any items only if it contains something
 [0] //0th item, undefined if no answers, one of strings above if does, then negated by ! at top.

There's got to be a better way to do all the .includes.

emanresu A
  • 46.2k
  • 5
  • 111
  • 257

AltStyle によって変換されたページ (->オリジナル) /