我不是javascript的初学者.我实际上已经工作了3-4个月,但今天我读到了关于"什么是JavaScript?"的声明.
JavaScript是单线程,非阻塞,异步,并发语言.
我迷路了.如果JavaScript是单线程的,它是如何并发的又是如何异步的,因为你需要跟踪你的异步代码正在做什么而没有另一个线程,是不是可以同时跟踪2个或更多代码?
我是个初学者,可以做出反应,发现自己在mixin和装饰器之间感到困惑。有人可以详细说明吗?谢谢。
当我尝试运行以下代码时:
#include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"};
int i = 0, j = 0;
a[0] = "hey";
for (i = 0;i < 10; i++)
printf("%s", a[i]);
}
Run Code Online (Sandbox Code Playgroud)
它给了我输出为:
heyhellohow(null)(null)(null)(null)(null)(null)(null)
Run Code Online (Sandbox Code Playgroud)
而当我在printf语句中插入'\n'时:
#include <stdio.h>
void main()
{
char *a[10] = {"hi", "hello", "how"};
int i = 0, j = 0;
a[0] = "hey";
for (i = 0;i < 10; i++)
printf("%s\n", a[i]);
}
Run Code Online (Sandbox Code Playgroud)
它给了我以下输出:
hey
hello
how
Segmentation fault
Run Code Online (Sandbox Code Playgroud)
我试着在网上阅读材料,这一点,我发现这是因为格式说明,并自动转换的printf来放编译器和却将不承认"%S …
我有一个现有的 React/Redux 项目,并且我已经开始在我的项目中使用 typescript。我已经为扩展airbnbeslint 配置的项目设置了我的eslint 配置。我的 eslint 如下:
module.exports = {
"parser": "babel-eslint",
"extends": [
"airbnb",
"plugin:flowtype/recommended"
],
"plugins": [
"react",
"jsx-a11y",
"flowtype"
],
"env": {
"browser": true,
"node": true,
"es6": true
},
"globals": {
"__DEV__": true,
"__SERVER__": true,
"__": true,
"define": true,
"describe": true,
"expect": true,
"require": true,
"test": true,
},
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true, …Run Code Online (Sandbox Code Playgroud) 我一直在使用Javascript.最近他们在ES6中增加了箭头功能,这些功能也有好处
this但是它有一些使用箭头功能的缺点:
Function原型我想问下面的事情:
Function原型?我问这个是因为mdn页面说它没有原型,但没有解释为什么它没有原型.
我阅读了Eric Elliot的这个系列文章,我认为我们正在使用javascript中的函数式编程方法,并且由于计划发布,我们是否有机会在不久的将来删除OOPS?
javascript ×3
ecmascript-6 ×2
reactjs ×2
asynchronous ×1
c ×1
eslint ×1
html ×1
pointers ×1
prettier ×1
printf ×1
string ×1
typescript ×1