[Question]
  [
# Background
One of the commonly meme'd aspects of javascript is its incredibly loose type coercion that allows for `+!![]+[+[]] == '10'` this technique can also be used to create letters as seen in the following example:
```
[[][[]]+[]][+[]][-~[]] == 'n'
[undefined+[]][+[]][-~[]] // [][[]] -> undefined
['undefined'][+[]][-~[]]  // undefined+[] -> 'undefined'
['undefined'][0][-~[]]    // +[] -> 0
'undefined'[-~[]]         // ['undefined'][0] -> 'undefined'
'undefined'[1]            // -~[] -> -(-1) -> 1
'n'
```
Some examples of js coercions:
```
[][[]] = undefined        // out of bounds array access returns undefined
+[][[]] = NaN             // the unary + operator coerces to numbers +undefined is NaN
+[] = 0                   // empty arrays coerce to the number 0
~[]/[] = -Infinity        // ~ coerces any value to a number then does bitwise negation and / coerces the second value to a number
[]+{} = '[Object object]' // plus coerces both values into strings if it can't do numeric addition
![] = false               // ! coerces empty arrays to false
!![] = true               // negation of previous coercion
+!![] = 1                 // number coercion of true
-~[] = 1                  // ~ coerces [] to 0 and the bitwise negation of 0 is -1, -(-1)=1
true+[] = 'true'          // adding an empty array to a primitive coerces it to a string
'true'[+[]] = 't'         // strings are treated as arrays by js
'true'[-~[]] = 'r'
```
[Here's a reference table of js coercions using different operators](https://delapouite.com/ramblings/javascript-coercion-rules.html)
Note: blue shaded cells in the table are strings while yellow cells are literals.
# Task
Given a string with only the letters `abcdefijlnorstuy` , convert it to valid javascript containing only the characters `[]+-~/{}!` that evaluates to the original string. **Note that this is not JSFuck** but is instead focused purely on a subset of strings that can be (relatively) concisely translated.
# Input
Any lowercase string that can be written with the letters `abcdefijlnorstuy`  (can include spaces)
# Output
Valid javascript containing only the characters `[]+-~/{}!` that will evaluate to the original word in a js environment.
# Examples
```
f('u') -> [[][[]]+[]][+[]][+[]]
f('a') -> [+[][[]]+[]][+[]][-~[]]
f('t') -> [-~[]/[]+[]][+[]][-~[]-~[]-~[]-~[]-~[]-~[]]
f('o') -> [[]+{}][+[]][-~[]]
f('l') -> [![]+[]][+[]][-~[]-~[]]
f('r') -> [!![]+[]][+[]][-~[]]
f('defined') -> [[][[]]+[]][+[]][-~[]-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]]+[[][[]
]+[]][+[]][-~[]-~[]-~[]-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]-~[]-~[]]+[[][[]]+[]][
+[]][-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]]+[[][[]]+[]][+[]][-~[]-~[]]
f('aurora borealis') -> [+[][[]]+[]][+[]][-~[]]+[[][[]]+[]][+[]][+[]]+[!![]+[]][
+[]][-~[]]+[[]+{}][+[]][-~[]]+[!![]+[]][+[]][-~[]]+[+[][[]]+[]][+[]][-~[]]+[[]+{
}][+[]][-~[]-~[]-~[]-~[]-~[]-~[]-~[]]+[[]+{}][+[]][-~[]-~[]]+[[]+{}][+[]][-~[]]+
[!![]+[]][+[]][-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]]+[+[][[]]+[]][+[]][-~[]]+[![]
+[]][+[]][-~[]-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]-~[]-~[]]+[![]+[]][+[]][-~[]-~[
]-~[]]
f('code tennis') -> [[]+{}][+[]][-~[]-~[]-~[]-~[]-~[]]+[[]+{}][+[]][-~[]]+[[][[]
]+[]][+[]][-~[]-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]]+[[]+{}][+[]][-~[]-~[]-~[]-~[
]-~[]-~[]-~[]]+[-~[]/[]+[]][+[]][-~[]-~[]-~[]-~[]-~[]-~[]]+[[][[]]+[]][+[]][-~[]
-~[]-~[]]+[[][[]]+[]][+[]][-~[]]+[[][[]]+[]][+[]][-~[]]+[[][[]]+[]][+[]][-~[]-~[
]-~[]-~[]-~[]]+[![]+[]][+[]][-~[]-~[]-~[]]
f('js bad') -> [[]+{}][+[]][-~[]-~[]-~[]]+[![]+[]][+[]][-~[]-~[]-~[]]+[[]+{}][+[
]][-~[]-~[]-~[]-~[]-~[]-~[]-~[]]+[[]+{}][+[]][-~[]-~[]]+[+[][[]]+[]][+[]][-~[]]+
[[][[]]+[]][+[]][-~[]-~[]]
f('obfuscate') -> [[]+{}][+[]][-~[]]+[[]+{}][+[]][-~[]-~[]]+[[][[]]+[]][+[]][-~[
]-~[]-~[]-~[]]+[[][[]]+[]][+[]][+[]]+[![]+[]][+[]][-~[]-~[]-~[]]+[[]+{}][+[]][-~
[]-~[]-~[]-~[]-~[]]+[+[][[]]+[]][+[]][-~[]]+[-~[]/[]+[]][+[]][-~[]-~[]-~[]-~[]-~
[]-~[]]+[[][[]]+[]][+[]][-~[]-~[]-~[]]
```
# Rules
Lowest byte count wins.
The solution can be written in any language, but the generated code must evaluate in either chrome, firefox, or a node.js repl.
Don't abuse any common loopholes.
  
[Answer]
# JavaScript (ES6), ~~139~~ 135 bytes
```
s=>[...s].map(c=>`[{},!![,[][[],![,~[]/[`.split`,`.some(s=>i=~eval(S=`[${s}]+[]][+[]]`).search(c))&&S+`[${'-~[]'.repeat(~i)}]`).join`+`
```
[Try it online!](https://tio.run/##XY/BbsMgDIbveQoqTQWUlD3AlNz6BD0yJFzqbEQUIkgqTVX66pmzbpcdPsv@f9uyB7hBcdmP0yGmC659u5a200qpYtQVRuHazur70ux2utFGa9NQ8tDmVVtVxuAn21CSrihozrcPvEEQp9bql3tZTK2N0VuwUhWE7D6Fk3K/P9VbAz/QIq4yjgiTeHi5bH1D8tHWdn3TFWN85g0HYiISEYhMfPFmsy/Y@4iXZwFzThnYOWWE4MtTdPQWmzDGP2Eo7Ay/E@ncz8XBhLwylepTPgKdWFjbsTv5LsWSAqqQPkRGklkvipT/nJ@XyZasZvw9clktcv0G "JavaScript (Node.js) – Try It Online")
### How?
The following code snippets are used:
```
 code             | string            | used for
------------------+-------------------+-------------------------------------
 [[{}]+[]][+[]]   | '[object Object]' | space, 'b', 'c', 'e', 'j', 'o', 't'
 [!![]+[]][+[]]   | 'true'            | 'r', 'u'
 [[][[]]+[]][+[]] | 'undefined'       | 'd', 'f', 'i', 'n'
 [![]+[]][+[]]    | 'false'           | 'a', 'l', 's'
 [~[]/[]+[]][+[]] | '-Infinity'       | 'y'
```
We pick the appropriate character in the resulting string with `[-~[]-...-~[]]`.
We can't access index \$0\$ this way, so we make sure that the snippets are ordered in such a way that this is never required. For instance, '*u*' is taken from '*true*' rather than from '*undefined*'.
[Answer]
I have a solution which works if you have infinite time and memory. I'm not 100% sure whether that's allowed within the rules here; I searched on [codegolf.meta.SE](https://codegolf.meta.stackexchange.com/) and didn't find anything saying that code-golf answers have to run in a reasonable length of time using a reasonable amount of memory. I also didn't find it forbidden in the "common loopholes" thread. If it makes my solution invalid, please let me know.
# JavaScript (ES6), ~~112, 110, 107~~ 106 bytes
```
s=>{for(q=[''];;c=q.shift(),q.push(...[...'[]+-~/{}!'].map(x=>c+x)))try{return eval(c)===s?c:d}catch(e){}}
```
It isn't restricted to string inputs, and can find short solutions in reasonable times, but unfortunately it's not feasible to solve for non-empty strings, even just single-characters like `'o'`. Here it is working on some inputs for which it is feasible.
```
> f(0)
"+[]"
> f(1)
"-~[]"
> f(-1)
"~[]"
> f(true)
"!+[]"
> f(false)
"![]"
> f('')
"[]+[]"
```
### How?
It's a breadth-first search. `q` is the queue, `c` is the current string. The breadth-first search algorithm will iterate through every possible string formed from the given alphabet, in order of length, so if a solution exists, it will be found.
We try evaluating `c` with the `eval` function, and return it if it evaluates to `s`. This comparison is done with `===` to avoid e.g. returning `+[]` which evaluates to 0 when we're looking for an expression which evaluates to the empty string. The variable `c` is uninitialised on the first iteration of the loop, but that's OK because it's only used within the `try` block.
We need `try`/`catch` because most candidate strings have syntax errors; as a bonus, instead of guarding the `return` with an `if` statement, we can return the non-existent name `d` because the error will get caught, allowing the loop to continue searching. This saves one byte, but it means the function stops working if you declare a variable named `d`, which is mildly amusing.
[Answer]
# [Python 2](https://docs.python.org/2/), 125 bytes
Using a single code snippet.
```
print[]
for c in input():print'+[{}+!![]+![]+~[]/[]+[][[]]][+[]]['+'-~[]'*(ord('#2??;"?4?9 &?/5%03!$B'[ord(c)%59%21])-31)+']'
```
[Try it online!](https://tio.run/##HYlBCsIwFET3niKJxt8YSm1qF9VFwGt8/qK2igVJSmwXInr1mAozzGPe@Jru3pkYxzC4CWl184F1bHAp4zxl6vgXoPH90Zwj6aVfpCINEiIRYQJC0JCnH3aZD30Ga2PtSdiDbdjWFrXcV3xzBlxcp2TdSFOSyqtSaSCIUbRz8KFlFx@u7WN4ivgD "Python 2 – Try It Online")
[Try the output in JS!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z@cn1ecn5Oql5OfrvE/OpZLO7q6VltRMTpWG4TromP1gVR0bHR0bGxsNJARG60LFKQmpped9LCHWDsGk1sGU1ySon@oh/VwzmuDxd7B6qbY/5r/AQ)
---
# [Python 2](https://docs.python.org/2/), ~~167~~ 150 bytes
*Saved 2 bytes thanks to @JonathanAllan*
```
print[]
for c in input():i=ord(".@C1A83J42/K70DIY"[ord(c)*91%211%23]);print'+['+"[{} !![ [][[] ![ ~[]/[".split()[i/9-5]+']+[]][+[]]['+'-~[]'*(i%9)+']'
```
[Try it online!](https://tio.run/##HUxRC4IwGHzvV8yBzDnUnEVZBEW9VL8gPr4Hs6KBuDH1IaL@@lrC3XHcHWde/VO30jljVdsDTh7akpqo1sMMfcRXaqPtLaLpdp/vlsVpJrPzYno4Xij885rHZR7K3LNAvh5fmAAmKLw/JAiAAAIg8eYLmAFNO9Mo/wsqK5M5CoYCEGEUJljiVyyOVFhyXzHnaDVYbSty1fZeNaqj7gc "Python 2 – Try It Online")
[Try the output in JS!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z@cn1ecn5Oql5OfrvE/OpZLO1oxOlY7OjY2Gkzo1gFJkCCGKG4ZkGh0dS1RpuC0ENMAXBi3alIdgt9O3GGDK2iiY4GIgC9wGgCW/K/5HwA)
### How?
This is based on the same code snippets as [my JS answer](https://codegolf.stackexchange.com/a/198474/58563), but a lookup string is used to retrieve the snippet ID and the position of the character.
Given the ASCII code \$c\$ of the character to be converted, the position in the lookup string is given by:
$$i=((c\times91)\bmod211)\bmod23$$
Given the ASCII code \$n\$ of the \$i\$-th character in the lookup string `".@C1A83J42/K70DIY"`:
* the snippet ID is \$\lfloor(n-45)/9\rfloor=\lfloor n/9\rfloor-5\$
* the position of the character is \$(n-45)\bmod9=n\bmod9\$
This is summarized in the following table.
```
 char. | ASCII code | -45 | //9 | mod 9 | character lookup     | output
-------+------------+-----+-----+-------+----------------------+--------
  '.'  |     46     |   1 |  0  |   1   | '[object Object]'[1] |  'o'
  '@'  |     64     |  19 |  2  |   1   | 'undefined'[1]       |  'n'
  'C'  |     67     |  22 |  2  |   4   | 'undefined'[4]       |  'f'
  '1'  |     49     |   4 |  0  |   4   | '[object Object]'[4] |  'e'
  'A'  |     65     |  20 |  2  |   2   | 'undefined'[2]       |  'd'
  '8'  |     56     |  11 |  1  |   2   | 'true'[2]            |  'u'
  '3'  |     51     |   6 |  0  |   6   | '[object Object]'[6] |  't'
  'J'  |     74     |  29 |  3  |   2   | 'false'[2]           |  'l'
  '4'  |     52     |   7 |  0  |   7   | '[object Object]'[7] |  ' '
  '2'  |     50     |   5 |  0  |   5   | '[object Object]'[5] |  'c'
  '/'  |     47     |   2 |  0  |   2   | '[object Object]'[2] |  'b'
  'K'  |     75     |  30 |  3  |   3   | 'false'[3]           |  's'
  '7'  |     55     |  10 |  1  |   1   | 'true'[1]            |  'r'
  '0'  |     48     |   3 |  0  |   3   | '[object Object]'[3] |  'j'
  'D'  |     68     |  23 |  2  |   5   | 'undefined'[5]       |  'i'
  'I'  |     73     |  28 |  3  |   1   | 'false'[1]           |  'a'
  'Y'  |     89     |  44 |  4  |   8   | '-Infinity'[8]       |  'y'
```
[Answer]
# Prolog (SWI), 269 bytes
It's not a particularly short solution, but made this challenge interesting because it is able to use backtracking to automatically select which string and index into that string to use for each character. 
```
`fals`^`![]+[]`.
`[object `^`[]+{}`.
`und`^`[][[]]+[]`.
`-Infinity`^`~[]/[]+[]`.
`tr`^`!![]+[]`.
[]-`[]`.
[H|T]-S:-B^C,nth0(I,B,H),length(L,I),foldl([_,V]>>append(`-~[]+`,V),L,` +[]`,J),T-U,append([`[`,C,`][+[]][`,J,`]+`,U],S).
S/W:-S+A,A-B,W+B.
A+B:-string_codes(A,B).
```
[Try it online!](https://tio.run/##ZVJNb@MgFLz7V7C@BJSHveeoihRXrZqqUg7ul8S6Bds4sZcFC3CraLf717M4TaMoe@K9mTcDDJTCbXaV8BcXk6vV9QTNkZfOJ73a8UYox1/4N1ZMWcGTiDNTdrLyKIAB@/0xYoOu9y1jxdcYXeqm1a3fBuIvK9Kj3tvR7ujHCso/i5s/9wXNZzR7uQTtN9/xEjK4IaCkXvsNvoMlgcaoWmH2Co/FfC76Xuoacxr8pxweCdwBR6Mt3BK4pw9wmGCccbgEXrBAFqG@DXVQPBSQkyTK06cZzacLWNAMnqZZEi2m2Yw6b1u9fq1MLR1eQEaS3ZhKOBZaETSjaJnmgN5t6yVeAYoro51RMlFmjWNywuSnTUx@6DhsGnKOUtP7tLcmKKh7b9Oy1WlYe/UVf3iItJZvqR6U@pzuxJtwlW17T13f1tL@Mvqn3O6lnUNm8P3gk87tTLg5nhz7ySELeCYQob0/jkVZ1bJpO6S0sc4P2xjQKT@SWtZnqBissQKVxkqhWnfGjnGFUuv/mHC8UpybmbIZXPh58oBXyjiJn0mCkugf "Bash – Try It Online")
# Ungolfed Code
```
% Declaration of strings we can generate with their corresponding JS.
base_str(`undefined`,`[[][[]]+[]][+[]]`).
base_str(`[object Object]`, `[]+{}`).
base_str(`Infinity`, `[-~[]/[]+[]][+[]]`).
base_str(`NaN`, `[+[][[]]+[]][+[]]`).
base_str(`true`, `!![]+[]`).
base_str(`false`, `![]+[]`).
% Construct JS used to index into strings
wtf_index(0,`+[]`).
wtf_index(1,`-~[]`).
wtf_index(N, S0) :-
  N > 1,
  wtf_index(1, S1),
  M is N - 1,
  wtf_index(M, S2),
  append([S1,`+`,S2],S0).
% Construct JS used for single char
wtf_char(C, WC) :-
  % Find known string with desired character at some index
  base_str(S, WS),
  nth0(I, S, C),
  % JS for this index
  wtf_index(I, WI),
  % JS to select index from string
  append([`(`,WS,`)[`,WI,`]`],WC).
% Map wtf_char over string, reducing to single string
wtf_list([], `[]`).
wtf_list([H|T], WS) :-
  wtf_char(H, WH),
  wtf_list(T, WT),
  append(WH, [0'+|WT], WS).
wtf_str(S, W) :-
  string_codes(S, SC),
  wtf_list(SC, WC),
  string_codes(W, WC).
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 104 bytes
```
s=>[...s].map(c=>(p=`[{}+!![]+![]+~[]/[]+[][[]]][+[]]`)+`[${'-~[]'.repeat(eval(p).search(c))}]`).join`+`
```
[Try it online!](https://tio.run/##XY/RasQgEEXf8xUuFFSyaz@gJG/9Cis4MZM2IaviJAslpL@eznbblz4cdO5x4DrBDSiUMS@XmHo8huagprXGGHLmClmFplW58Xbb69PJuvrOl3XPfFhnrXPO8sV5XXv7tMkLO2kKZoRF4Q1mlbUhhBI@VNB654dmSmP0tT9ebCWEXOVZArMwiZmZwnzK8133OIwR@8cAa0kFRJcKwjzSIwzcWywY418wkejgdyN1w0oBFpSVq8yQyitwExJNKzb2IUVKM5o5vauCHItBkdb/zM8/WGtRC/kWpa52fXwD "JavaScript (Node.js) – Try It Online")
**Explanation**
Each letter is converted to a string of the form
```
[{}+!![]+![]+~[]/[]+[][[]]][+[]][x]
```
Where `x` is a number of `-~[]`
`[{}+!![]+![]+~[]/[]+[][[]]][+[]]` evaluates to the string `[object Object]truefalse-Infinityundefined`, which contains all of our letters. We then index into it by using this snippet:
```
`[${'-~[]'.repeat(eval(p).search(c))}]`
```
It evaluates `[{}+!![]+![]+~[]/[]+[][[]]][+[]]` (stored in variable p), then finds the first index of the current letter we are processing. We repeat the string `+~-[]` (evaluates to 1) that number of times. That is wrapped around with square brackets, and appended to `p`.
Finally, everything is joined with `+`.
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 156 bytes
```
x=>string.Join('+',x.Select(l=>"[{}+!![]+![]+~[]/[]+[][[]]][+[]]["+new StringBuilder().Insert(0,"-~[]",$"[object {0,8}ru fals{0,9}y nd fi".IndexOf(l))+"]"))
```
[Try it online!](https://tio.run/##TY0xT8MwEIVn@iuuFlJtJQ0di0o7MCCBkBg6MFgeHOcMrixbsh0IisJfD3azMNy7d09336m4VdHMT71TDzEF4z7qpZ30cR6Op2VoXrxxdFNt6qE5o0WVqD2eCB@nar3moir1y8VdblxwLoTg2QhOKoffcL4yHntjOwyUNc8uYkh0V5NtPiL1LeG@vWQojLt6P4UetLQx@/vpB1wH2pB80@HwpqllrCKCMDYfVtoHlOqTfskACWMC4yD/42IEIkkNJBXxRWyRUKRDbRx2xco@@CChLRhrYomU7zCznFvGS4RWXnd9q/uoZEIyMRhXN@/BJHzNJFo@s8P/RC9ZDqf5Dw "C# (Visual C# Interactive Compiler) – Try It Online")
**Explanation**
Each letter is converted to a string of the form
```
[{}+!![]+![]+~[]/[]+[][[]]][+[]][x]
```
Where `x` is a number of `-~[]`
`[{}+!![]+![]+~[]/[]+[][[]]][+[]]` evaluates to `[object Object]truefalse-Infinityundefined`, which contains all the letters. We index into the string `$"[object {0,8}ru fals{0,9}y nd fi"`, which expands to 
```
[object        0ru fals        0y nd fi
```
We take the current letter and get the first index of it in that string. We then repeat the string `-~[]` that number of times, and replace the `x` with that.
Repeating a string is rather verbose in C#, as there is no builtin for it. Instead, a `StringBuilder` is created, and taking advantage of the `StringBuilder.Insert(int, string, int)` overload (which inserts the string `n2` times at index `n1`) to created a `StringBuilder` containing a repeated string. It is implicitly converted to a string due to the magic of the `+` operator.
```
new StringBuilder().Insert(0,"+-~[]",$"[object {0,8}ru fals{0,9}y nd fi".IndexOf(l))
```
Finally, the converted strings are joined together with `+`.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 95 bytes
```
≔⪪“<≦ω≕ε…(Ｂς´Ｂ⌈ＹWγ№Φξ⌕IY¦l ”,ηＦＳ«≔⊟Φ⁵№§ηκιζ⊞υ⪫[]⁺⁺§⪪“"∧｜⌊AuüQ⁷～⊙<⁷≕u?ψμ”,ζ×+[]][²×-~[]⌕§ηζι»⪫υ+
```
[Try it online!](https://tio.run/##TY/LasMwEEXX8VeoWo2IQqHQVVehEEhXhnQnaeHYTqxUHRk9SuuQ/Lo7Me4DNFdwZ3TnqO6qUPvKjeM6RntE2PXOJuAaNTZSY@UiachSa8SDvdkav8jy@1NbJ8YlHS4k68RTcfCBwRb7nHYpWDyCEOxcLObk0vewsS61AR4le/YZE6zTFpv2EzrJ3ijECkE6UNSizLGDLNmLtwhcGVpUuhxhkp9nM6wyShkj7xTVTa7K3NN1vvzSDVSv9r2NwJc0qqjxIP681XVasLHY/EcaZiTiuRQl/SjBhENYfMnJHsdTZPuqKcbVh/sG "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
≔⪪“<≦ω≕ε…(Ｂς´Ｂ⌈ＹWγ№Φξ⌕IY¦l ”,η
```
Split the compressed string `"\n\nd,\nals,\nru,\\nnfi\n\n\ny,\nobject "` on commas. This is the array `["undefined", "false", "true", "Infinity", "[object Object]"]` keeping only the space and unique letters and truncated at the last remaining letter to improve the compression.
```
ＦＳ«
```
Loop over the input string.
```
≔⊟Φ⁵№§ηκιζ
```
Find the entry that contains the current input character.
```
⊞υ⪫[]⁺⁺§⪪“"∧｜⌊AuüQ⁷～⊙<⁷≕u?ψμ”,ζ×+[]][²×-~[]⌕§ηζι
```
Split the compressed string `"[][[]],![],!![],~[]/[],{}"` on commas and take the matching entry, then concatenate it with `"+[]]["` doubled and a suitable number of repetitions of `"-~[]"` before finally wrapping everything inside a final set of `[]`.
```
»⪫υ+
```
Join everything together with `+`s.
]