Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第三题为何不相同? #2

Open
maczyt opened this issue Mar 20, 2018 · 1 comment
Open

第三题为何不相同? #2

maczyt opened this issue Mar 20, 2018 · 1 comment
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@maczyt
Copy link

maczyt commented Mar 20, 2018

const obj = {
  x:1,
  y:2,
  a:1,
  b:2,
  c:3
}

测试:

fn1(obj)fn2(obj) log一样的数据, 求解

@justjavac
Copy link
Owner

const obj = Object.create({
  x:1,
  y:2,
  a:1,
  b:2,
  c:3
});

fn1:

let { x, y, ...z } = obj; 
// x: 1
// y: 1
// z: {}

fn2:

let { x, ...n } = obj;
// x: 1
// n: {}

let { y, ...z } = n;
// y: undefined
// z: {}

@justjavac justjavac added help wanted Extra attention is needed question Further information is requested labels Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants