yihong0618 / gitblog

People Die, but Long Live GitHub

Home Page:https://yihong0618.github.io/gitblog/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS存档

yihong0618 opened this issue · comments

JavaScript是如何工作的:引擎,运行时和调用堆栈的概述!

image
image
image

关于箭头函数

const myFunc = (stuff) => { someArray.push(stuff) }
const otherFunc = (stuff) => someArray.push(stuff)
console.log(myFunc())    // --> logs undefined
console.logo(otherFunc()) // --> logs result of push which is new array length
const x = () => {} // Does nothing
const y = () => ({}) // returns an object
  1. js的字符串也是不可变类型,需要先转换成数组
  2. 关于转换和python基本一样

map 必须用set 而不能像python那样直接a[2] =3 赋值