theNewfelll
theNewfelll

Reputation: 39

Creating a function over multiple lines - Javascript Challenge

I'm attempting to create a function over multiple lines. Parameters of the challenge: function returns 'barbarian' and only 2 characters per line. I keep trying to use a fat arrow to declare my function, but fat arrows don't seem to work if you don't have them connected.

My current work:

f=
(
)=>

'\
b\
a\
r\
b\
a\
r\
i\
a\
n\
s\
'

This works, but the ')=>' is 3 characters long. I really just want to know how it is possible to even stretch out the creation of a function. I can't find any info on it anywhere as it's obviously not very practical.

Upvotes: 1

Views: 274

Answers (2)

Kosh
Kosh

Reputation: 18444

You might use constructor of any built-in method e.g. of Array.prototype.map:

f=
[]
[
'\
m\
a\
p'
][
'\
c\
o\
n\
s\
t\
r\
u\
c\
t\
o\
r'
](
"\
r\
e\
t\
u\
r\
n\
'\
b\
a\
r\
b\
a\
r\
i\
a\
n\
s\
'"
)
console.log(f())

Upvotes: 1

sliptype
sliptype

Reputation: 2974

Here is what I did:

https://jsfiddle.net/wwr66653/5/

The code is too big to post, see fiddle

This was done using http://www.jsfuck.com/ It's not practical but neither is the question

Upvotes: 1

Related Questions