[일일코딩 #26] javascript 이상한 Hello World! 출력 (미해결)

Daily Codewars #26

Question

codewars link
In order to stop too much communication from happening, your overlords declare that you are no longer allowed to use certain functionality in your code!

Disallowed functionality:

  • Strings
  • Numbers
  • Regular Expressions
  • Functions named “Hello”, “World”, “HelloWorld” or anything similar.
  • Object keys named “Hello”, “World”, “HelloWorld” or anything similar.
    Without using the above, output the string “Hello World!” to prove that there is always a way.

String, Numbers, Regex, 그리고 hello world랑 비슷한 문자가 들어가는 function, object key를 쓰지 말고 Hello world!를 출력하는 문제이다.

My Solution

var abc = function() {
  var obj = {
    dlroW:x, olleH:hello}
  var x = new String();
  String.constructor = Object.keys(obj).shift();
  console.log(x.constructor);
  var w1 = Object.keys(obj).shift();
}
var helloWorld = abc;

object의 키값으로 넣고, 그걸 reverse하는 식으로 해볼까 했는데.
계속 걸림돌이 되는 ‘!’의 문제.
결국 이 문제는 잠시 keep해놓기로… ㅠㅠ 빠가야로

Published by

Yurim Jin

아름다운 웹과 디자인, 장고와 리액트, 그리고 음악과 맥주를 사랑하는 망고장스터

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s