How to make a "Hello Word!" that way

Asked

Viewed 246 times

10

Without using the items below:

  1. String-like strings and functions before output
  2. Numbers
  3. Regular Expressions
  4. Functions with the names: "Hello", "World", "Helloworld" or anything similar only the output method var helloWord = function(){ //aqui seu código }.
  5. Without using object keys with names: "Hello", "World", "Helloworld" or anything similar.

I came to make the example below, but the problem identified that I am using string, someone has another idea?

http://jsfiddle.net/ivanferrer/qv2xtvcv/

  • 4

    excellent challenge, which objective, purely academic?

  • And store each character in one array? In one position goes H, in another E and so on. It is validated?

  • I found this, http://jsfiddle.net/E4b5d/1/ well loco oo.

  • 1

    @Henriquedpereira, is legal, but has string in this method.

  • 1

    @Giancarlogiulian this idea does not roll, because array has numeric key, we have tried this, using range.

  • 1

    @h3nr1ke this challenge was proposed in one of the steps of this site: http://www.codewars.com/ and I’m not able to think about how I could solve it otherwise.

  • Thank you for the comment @Ivanferrer

  • Here is an output that enabled you to solve the problem: http://www.jsfuck.com/

Show 3 more comments

2 answers

2

try to do the following:

function SGVsbG8gV29scmQh() { }
var helloWolrd = function () {
  alert(atob(new SGVsbG8gV29scmQh().constructor.name));
}
helloWolrd();

  • Cool, only you wrote the word World wrong and the main method is persistent, it has to be helloWorld()!

  • @Ivanferrer, corrected by.

  • The word is still wrong, @Tobymosque, you reversed the "r" and the "l"

1


I found the solution:

var helloWorld = function () {
  // Hello World!
  var start = [,,,,,,,,,,,,,,,,,,,].length,
      end = [,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,].length;
  alert(helloWorld.toString().slice(start, end));
}
helloWorld();
  • 3

    Functions with the names: "Hello", "World", "Helloworld" or anything similar.

  • But the function can be: hel = function() { ... }, the important thing is not to use the function name as a result, as I said, only output method.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.