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

day-03-普通对象的自身循环引用 #3

Open
H246802 opened this issue Nov 23, 2018 · 2 comments
Open

day-03-普通对象的自身循环引用 #3

H246802 opened this issue Nov 23, 2018 · 2 comments

Comments

@H246802
Copy link
Owner

H246802 commented Nov 23, 2018

创建一个对象 obj,使得 obj.obj.obj.obj.obj === obj,即,不管出现多少次 .obj,都得到 obj

@H246802
Copy link
Owner Author

H246802 commented Nov 23, 2018

// 无论多少个.obj 都还是obj本身
var obj = {}
obj.obj = obj

@H246802
Copy link
Owner Author

H246802 commented Nov 23, 2018

// 换种方式赋值
var obj = {}
Object.defineProperty(obj,'obj',{
	value:obj,
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant