换句话说,node.js等价于C的getchar函数是什么?(等待输入,当它得到它时,它返回字母的字符代码,后续调用从stdin获取更多字符)
我尝试搜索谷歌,但没有一个答案是同步的.
我觉得_.something(somevar, some_function_or_other_thing);"语法"很难看.什么是使用类似ruby的迭代器和类似的东西的一些好的替代品:
10..times(function(i) {
console.log(i);
});
uppercasefoobar = ["foo", "bar"].each(function(i) {
return i.toUpperCase();
});
Run Code Online (Sandbox Code Playgroud)
另外,我使用的是node.js,因此它应该更多地关注代码而不是DOM的东西.
有没有办法绕过这种行为?
> foo => bar;
[Function]
> const func = foo => bar;
undefined
> func
[Function: func]
Run Code Online (Sandbox Code Playgroud)
我有代码暂时存储这样的匿名函数,然后返回它.我不希望变量名的实现细节像这样暴露.