Javascripts Reviews

Js
For … in. 返回对象所含元素索引,传言不靠谱
for(var i in a){console.log(i)}
For … of for(var i of a){console.log(i)}遍历返回元素
for(var i of a){console.log(i)}
a.forEach((value)=>{console.log(value)})遍历返回元素
a.map((v,k)=>{})遍历索引and值

React js
Create react app

npx create-react-app first_react

npx(execute) nom(management)

App 目录下可运行的指令

Component 特点 state, update

What is javascript?

文档地址:https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript

Apis

* The DOM (Document Object Model) API allows you to manipulate HTML and CSS, creating, removing and changing HTML, dynamically applying new styles to your page, etc. Every time you see a popup window appear on a page, or some new content displayed (as we saw above in our simple demo) for example, that's the DOM in action.
* The Geolocation API retrieves geographical information. This is how Google Maps is able to find your location and plot it on a map.
* The Canvas and WebGL APIs allow you to create animated 2D and 3D graphics. People are doing some amazing things using these web technologies —see Chrome Experiments and webglsamples.
* Audio and Video APIs like HTMLMediaElement and WebRTC allow you to do really interesting things with multimedia, such as play audio and video right in a web page, or grab video from your web camera and display it on someone else's computer (try our simple Snapshot demo to get the idea).

Js作用域

全局变量都存储在window对象中,
全局变量,具有以下特征之一为全局变量:

1、函数外定义;
2、函数内未声明;
3、全局变量全局内皆可调用;

局部变量特征:

1、只能作用于函数内;
2、定义与全局变量同名的局部变量不会覆盖;
3、局部变量仅在函数执行时创建,执行完成后局部变量自动销毁
4、函数外不可访问

块级作用域

1、指在if、switch、for等语句块中定义的变量,不能在块之外被访问
2、var 不支持块级作用域
3、为了解决块作用域,引入了let和const,可以声明块级作用域的变量
生命周期:
1、一旦定义,一直存在;
2、仅可在块内被访问。

this 指向对象

use strict 模式下,this默认为undefined,其他默认为window对象
函数被调用时,指向当前方法的实例化对象

变量作用域搜寻逻辑,当前环境往上

相关文章:
https://www.cnblogs.com/itjeff/p/10106855.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值