Typography

活版印字


  • Home
  • Archive
  • Categories
  • Tags
  •  

© 2020 alincode

Theme Typography by Makito

Proudly published with Hexo

cloneDeep

Posted at 2017-11-09 lodash 

1
2
3
4
5
6
7
8
9
10
11
12
13
var _ = require('lodash');

const USER = ['id', 'firstname', 'lastname', 'fullname'];
let USER2 = USER;
_.pull(USER2, 'fullname')
console.log(USER);
console.log(USER2);

const TEACHER = ['id', 'firstname', 'lastname', 'fullname'];
let TEACHER2 = _.cloneDeep(TEACHER);
_.pull(TEACHER2, 'fullname')
console.log(TEACHER);
console.log(TEACHER2);
1
2
3
4
5
6
=== output ===

[ 'id', 'firstname', 'lastname' ]
[ 'id', 'firstname', 'lastname' ]
[ 'id', 'firstname', 'lastname', 'fullname' ]
[ 'id', 'firstname', 'lastname' ]

Share 

 Previous post: Modern Web 2018 - 使用 Swagger 協助你設計出更好的 API Next post: 蓋伊‧川崎的創業教練課 - 提案 

© 2020 alincode

Theme Typography by Makito

Proudly published with Hexo