# “Could you repeat yourself?” aka Could a doubled character solution exist in JavaScript? [duplicate]

This thinking exercise is inspired from Super Chafouin's question "Just Repeat Yourself" in which the phrase "Do not repeat yourself!" had to be outputted using code that was basically a series of doubled characters, inclusive of newlines, so code like:

((zz==0011))&&((mm++&&mm++&&mm++&&mm++&&mm++&&nn--&&nn--&&nn--&&nn))

would be considered valid code.

It got me thinking, is a JavaScript solution possible? Now at this point in time, I'm no longer concerned with putting in a competing entry for Super Chafouin's question, there's a lot of entries in there far better than anything I could have come up with in that short a period of time. I'm looking at this from the perspective of a programmer who loves what he does and wants to see how far he can push the limits...

So that being said, JavaScript conforming to the rules makes for some rather difficult challenges... No modulo, no bitwise operations, standard concatenation and arithmetic functions are rendered useless save for ++ and --, and standard assignments as far as I know are thrown out the window.

Numbers and booleans are a little easier, I managed to work out the following using Chrome and ES7.

neg_two = --[[]][[00]]<<++[[]][[00]] // neg_one << one
neg_one = --[[]][[00]]
neg_half = ((--[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]])) // neg_two ** neg_one
zero = 00 // octal representation
third = ((0011**((((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]]))))))**--[[]][[00]] // (nine ** (two ** neg_one)) ** neg_one
half = ((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]])) // (one << one) ** neg_one
one = ++[[]][[00]]
two = ++[[]][[00]]<<++[[]][[00]] // one << one
three = 0011**((((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]])))) // (nine ** (two ** neg_one))
four = ++[[]][[00]]<<++[[]][[00]]<<++[[]][[00]] // one << one << one
five = 11>>++[[]][[00]] // eleven >> one
six = 0011**((((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]]))))<<++[[]][[00]] // (nine ** (two ** neg_one)) << one
seven = ((99>>++[[]][[00]]))**((((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]])))) // (99 >> one) ** (two ** neg_one))
eight = ++[[]][[00]]<<++[[]][[00]]<<++[[]][[00]]<<++[[]][[00]] // one << one << one << one
nine = 0011 // octal representation
ten = ~~((1100**((((0011**((((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]]))))))**--[[]][[00]])))) // ~~(1100 ** ((nine ** (two ** neg_one)) ** neg_one))
eleven = 11 // decimal representation
twelve = 0011**((((++[[]][[00]]<<++[[]][[00]]))**((--[[]][[00]]))))<<++[[]][[00]]<<++[[]][[00]] // (nine ** (two ** neg_one)) << one << one
_false = !!00
_true = !!11


Beyond that I'm at a loss, because if I did want to output the target phrase, I would need some form of concatenating a string to another, and I would then be able to basically chain strings with array references to extract the individual characters and so on...

Bearing this in mind, strings are a bit of a loss (so I believe, I may be mistaken), , "" and '' won't really do much as you can imagine. I'm not sure about the validity of control characters, like \0 or literal \n, \t, \r for example...

So for the purposes of this thinking exercise... providing thoser control characters and escape sequences were okay, is there anything more that one could do to get closer to a solution of assigning values, concatenating strings, coercion, etc.?

Please note, as I said earlier in the post, this is not to finally put in an entry for the originating question... I just want to see how far one could take this rule with JavaScript and what you could potentially do...

• I think this really should of been posted as a bounty on the original question rather than a seperate language specific post – Downgoat Sep 29 '16 at 3:57
• @Downgoat If I knew that was permitted, i probably would have. I'm going to be placing a bounty on this question nevertheless. – Eliseo D'Annunzio Sep 29 '16 at 4:03
• The place for discussions is chat, not main. I suggest creating a chat room, linking it from the comments of the original question, and deleting this one. – Peter Taylor Sep 29 '16 at 7:41
• @PeterTaylor If you look at the first two sentences of this similar question This is not a challenge but a question, I figured it was on topic because of Non-challenge questions that are related to solving programming puzzles or a particular type of challenge are also on topic. I think this is a perfectly fine question, not a dupe. – James Sep 29 '16 at 15:20
• @WallyWest I don't think this is possible. You'll need to represent strings, but you can't cast to string with a regular ol' +. I've tried my hand at this for an hour, no luck. (My personal luck with numbers gave ~~"" for zero a la JSF.) – Conor O'Brien Sep 30 '16 at 13:09