简体   繁体   English

不使用任何字母javascript就返回hello world

[英]return hello world without using any letters javascript

This question is really bothering me! 这个问题真的困扰我!

My original solution looked like this: 我原来的解决方案如下所示:

function f(){
  return String.fromCharCode(72,101,108,108,111,44,32,119,111,114,108,100,33);
}

The error I am getting is Your solution uses o letter 我收到的错误是Your solution uses o letter

My thought was that it was that there is an o in fromCharCode but then I also tried generating "Hello, world!" 我以为那是fromCharCode中有一个o ,但后来我也尝试生成"Hello, world!" here to guarantee no o is in the function, however, I saw the same error. 这里保证函数中没有o ,但是,我看到了相同的错误。

Can anyone spot anything silly I may be missing? 谁能发现我可能会错过的任何愚蠢的东西?

This works: 这有效:

f = () => '\x48\x65\x6C\x6C\x6F\x2C\x20\x77\x6F\x72\x6C\x64\x21';

Time: 362ms Passed: 102 Failed: 0 时间:362毫秒通过:102失败:0

Test Results: 检测结果:

  • Test Passed: Value == 'Hello, world!' 测试通过:值=='您好,世界!'

    • Banned letters check in your Solution 被禁止的信件检查您的解决方案

    • Is there any letter from hello world? 你好世界有来信吗?

    • Completed in 2ms 2ms内完成

  • Some random tests would be nice. 一些随机测试会很好。

    • Random Tests (100 of 100 Assertions) 随机测试(100个断言中的100个)

    • Completed in 22ms 22ms内完成

You have passed all of the tests! 您已通过所有测试! :) :)

The Function is working fine. 该功能运行正常。 Please find the working sample: https://jsfiddle.net/L6qh89b1/ 请找到工作示例: https : //jsfiddle.net/L6qh89b1/

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script>
  function f(){
  return String.fromCharCode(72,101,108,108,111,44,32,119,111,114,108,100,33);
}

    document.write(f());
  </script>
</head>
<body>

</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM