Click here to Skip to main content
15,882,163 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Recently, I have been solving different tasks at codewars.com to craft my javascript skills. While, usually I try really hard to find a solution myself before asking somebody`s help, this time I am really confused.
I have been asked to print "Hello world" without using:
- strings,
- numbers,
- regular exps,
- functions,
- object keys.
Is this really possible? Can I actually do it?
P.S I am sure there is a way to do it but I just can`t think of any.

What I have tried:

I found this article but it only tells a way to use numbers without actually using numbers, is there a similar way to do the same with letters?
Brainfuck beware: JavaScript is after you! | Patricio Palladino[^]
Posted
Updated 5-Aug-16 18:44pm
v2
Comments
George Jonsson 5-Aug-16 20:57pm    
Can you use characters and arrays?
AlexLearne 6-Aug-16 2:28am    
The thing is no, I think I found a similar solution and alerts "Hello world!" and I would like it to return "Hello world". Look at this code, do you have any idea how I can correct it?

a=Array();
a[(!a+a)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[+a]+(!!a+
a)[!+a+!+a+!+a]+(!!a+a)[+!+a]][(a[(!a+a)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!
+a]+(!!a+a)[+a]+(!!a+a)[!+a+!+a+!+a]+(!!a+a)[+!+a]]+a)[!+a+!+a+!+a]+(!!a+a[(!a+a
)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[+a]+(!!a+a)[!+a+!+a+!+a]+(!
!a+a)[+!+a]])[+!+a+[+a]]+(a[a]+a)[+!+a]+(!a+a)[!+a+!+a+!+a]+(!!a+a)[+a]+(!!a+a)[
+!+a]+(a[a]+a)[+a]+(a[(!a+a)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[
+a]+(!!a+a)[!+a+!+a+!+a]+(!!a+a)[+!+a]]+a)[!+a+!+a+!+a]+(!!a+a)[+a]+(!!a+a[(!a+a
)[+a]+([!a]+a[a])[+!+a+[+a]]+(!a+a)[!+a+!+a]+(!!a+a)[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a+a)[+a]+(!!a+a)[!+a+!+a+!+a]+(!!a+a)[+!+a]]+a)[!+a+!+
a+!+a]

1 solution

Try this:
JavaScript
var s = ['h','e','l','l','o',' ','w','o','r','l','d'];
console.log(s.join(''));
 
Share this answer
 
Comments
AlexLearne 6-Aug-16 2:23am    
Thank you for your answer but you are using strings inside of your array and unfortunately that is not allowed as well as functions)
Mehdi Gholam 6-Aug-16 2:26am    
Use String.fromCharCode() and convert the letters to numbers first.
AlexLearne 6-Aug-16 2:53am    
Again, functions are not allowed. I posted an example above that alerts "Hello World", can I do the same using return? Take a look)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900