Some working memories (1)

1. Object reference

  In JS, var a = [1,2];var b=a; b.splice(0,1); I thought that the first item in array b would be deleted, but it turned out that the first item of data in a was also deleted ;

  var a = [1,2,3];

  var b = a;

  b.splice(1,1);

  console.log(b) //[1,3]

  console.log(a) //[1,3]

  I checked that this is caused by the pointer of the object pointing to the same place, but at present it can only be checked like this: var b = JSON.parse(JSON.stringfy(a)); The pointer can be changed by assignment conversion;

  Just checked the draft box, you need to look at the JS data type

2. CSS vertical centering

  What I knew before was display: flex; + align-items: center;

  But after checking, it seems that there are some other convenient css   https://www.zhihu.com/question/20543196

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324635337&siteId=291194637