JSFiddle - React, Tailwind, and code Playground

by namuol

HTML

<textarea id='words' placeholder='wordlist'></textarea>
<textarea id='solution' placeholder='reversibles' disabled='disabled'></textarea>
<br />
<button id='go'>go</button>

CSS

textarea {
    min-height: 400px;
}

CoffeeScript

String::reverse = -> @split('').reverse().join('')

match = (word, words) ->
  reverse = word.reverse()
  return (reverse isnt word) and (reverse in words)
  
$('#go').click ->
  words = $('#words').val().split('\n')
  $('#solution').text (word for word in words when match(word,words)).join('\n')