René's URL Explorer Experiment


Title: 闭包 · Issue #29 · paddingme/Learning-JavaScript · GitHub

Open Graph Title: 闭包 · Issue #29 · paddingme/Learning-JavaScript

X Title: 闭包 · Issue #29 · paddingme/Learning-JavaScript

Description: 闭包的两个特点: 闭包作为与函数成对的数据,在函数执行过程中处于激活(即可访问)状态; 闭包在函数运行结束后,保持运行过程的最终数据状态。 总的来说,函数闭包决定了:闭包所对应的函数代码如何访问数据,以及闭包内的数据何时销毁。 // 没有函数实例产生 function myFunc(){ } var f1 = myFunc; var f2 = myFunc; alert(f1 === f2) function MyObject(){ } MyObject.prototy...

Open Graph Description: 闭包的两个特点: 闭包作为与函数成对的数据,在函数执行过程中处于激活(即可访问)状态; 闭包在函数运行结束后,保持运行过程的最终数据状态。 总的来说,函数闭包决定了:闭包所对应的函数代码如何访问数据,以及闭包内的数据何时销毁。 // 没有函数实例产生 function myFunc(){ } var f1 = myFunc; var f2 = myFunc; alert(f1 === f2)...

X Description: 闭包的两个特点: 闭包作为与函数成对的数据,在函数执行过程中处于激活(即可访问)状态; 闭包在函数运行结束后,保持运行过程的最终数据状态。 总的来说,函数闭包决定了:闭包所对应的函数代码如何访问数据,以及闭包内的数据何时销毁。 // 没有函数实例产生 function myFunc(){ } var f1 = myFunc; var f2 = myFunc; alert(f1 === f2)...

Opengraph URL: https://github.com/paddingme/Learning-JavaScript/issues/29

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"闭包","articleBody":"闭包的两个特点:\n1. 闭包作为与函数成对的数据,在函数执行过程中处于激活(即可访问)状态;\n2. 闭包在函数运行结束后,保持运行过程的最终数据状态。\n\n总的来说,函数闭包决定了:闭包所对应的函数代码如何访问数据,以及闭包内的数据何时销毁。\n\n``` js\n// 没有函数实例产生\nfunction myFunc(){\n}\n\nvar f1 = myFunc;\nvar f2 = myFunc;\n\nalert(f1 === f2)\n```\n\n``` js\n\nfunction MyObject(){\n}\n\nMyObject.prototype.method = function(){}\n\nvar obj1 = new MyObject();\nvar obj2 = new MyObject();\n\nalert( obj1.method === obj2.method)\n\n// 对象的实例只持有原型中的方法的一个引用,因为也不产生(方法)函数的实例。\n\n```\n\n``` js\nfunction MyObject(){\n    this.method = function(){}\n}\n\nvar obj1 = new MyObject;\nvar obj2 = new MyObject;\nalert( obj1.method === obj2.method)\n//false\n```\n\n``` js\n//构造器函数\n\nfunction MyObject(){\n    var instance_data = 100;\n    this.getInstanceData = function(){\n        return instance_data;\n    }\n\n    this.setInstanceData = function(v) {\n        instance_data = v;\n    }\n}\n\n// 使用一个额匿名函数去修改构造器的原型 MyObject.prototype,以访问该匿名函数中的 upvalue\n\nvoid function(){\n    var class_data = 5;\n\n    this.getClassData = function(){\n        return class_data;\n    }\n\n    this.setClassData = function(v){\n        class_data = v;\n    }\n}.call(MyObject.prototype);\n\nvar obj1 = new MyObject();\nvar obj2 = new MyObject();\n\n// obj1 与 obj2 的 getInstance 是不同函数实例,因此访问的是不同闭包的 upvalue\nobj1.setInstanceData(10);\nconsole.log(obj2.getInstanceData());\n\n// obj1 与 obj2 的 getClassData 是同一个函数实例,因此在访问相同 的 upvalue. \nobj1.setClassData(20);\nconsole.log(obj2.getClassData());\n```\n\n``` js\n\nfunction aFunc(){\n    function MyFunc(){}\n    return myFunc;\n}\n\nvar f1 = new aFunc();\nvar f2 = new aFunc();\nconsole.log(f1===f2)\n//FALSE\n```\n\n``` js\n//foo \u0026 bar 产生函数实例\nfunction foo(){\n    var  MyFunc = function(){}\n    return MyFunc;\n}\n\nfunction bar(){\n    return function(){\n\n    };\n}\n```\n\n``` js\n//返回同一个实例\n\nvar aFun3 = function(){\n    var foo = function(){\n        console.log(111)\n    };\n\n    return function(){\n        return foo;\n    }\n}()\n\nvar f3 = aFun3();\nvar f4 = aFun3();\nconsole.log(f3 === f4)\n```\n\n调用对象:\n1. 对象属性与变量没有本质属性;\n2. 全局变量其实是“全局对象”的属性;\n3. 局部变量其实是“调用对象”的属性\n\n“调用对象”的局部变量维护规则\n1. 在函数开始执行时,varDecls 中所有值将被置为 undefined。 因此我们无论如何访问函数,变量初始值总为 undefined。\n2. 函数执行结束并退出时,varDecls 不会被重置,即有了函数能够提供“在函数内保存数据”。\n3. 函数内部数据持续的生存周期,取决于该函数实例是否存在活动引用——如果没有,则调用对象被销毁。\n\n“全局对象”的变量维护规则\n1. 由于该函数从来不被再次进入,因此不会被重新初始化;\n2. 由于该函数仅有一个个被系统持有的实例,因此他自身和内部数据总不被销毁。\n\n函数闭包 与 “调用对象”的生存周期\n\n在运行期改函数实例有一个函数闭包,在执行时,引擎会:\n- 创建一个函数实例;\n- 为该函数实例创建一个闭包;\n- 为改函数实例(及其闭包)的运行环境从 ScriptObject(调用对象) 复制一个调用对象。\n","author":{"url":"https://github.com/paddingme","@type":"Person","name":"paddingme"},"datePublished":"2015-08-22T08:55:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/29/Learning-JavaScript/issues/29"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:110cdb3a-7f77-16be-c117-17a60ef9e5c3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id95E4:4C21B:109F6F2:17E6241:6A5F4B5A
html-safe-nonce5def6ec0e45dde0a7a915b4da67bfeb11034ecaf21e30a49c9fc2ff0e286c984
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUU0OjRDMjFCOjEwOUY2RjI6MTdFNjI0MTo2QTVGNEI1QSIsInZpc2l0b3JfaWQiOiI0MjU3Nzk5MjY5MjgwMzM2NzMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac07b17a81824e051135d92bd1de83fabf0a038e47df39d197bfe390f61e50010f
hovercard-subject-tagissue:102518224
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/paddingme/Learning-JavaScript/29/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3aeeae63d388398e218a203a0b8b38d354020d8fa5b0c1056335b92bf6ea8cdd/paddingme/Learning-JavaScript/issues/29
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3aeeae63d388398e218a203a0b8b38d354020d8fa5b0c1056335b92bf6ea8cdd/paddingme/Learning-JavaScript/issues/29
og:image:alt闭包的两个特点: 闭包作为与函数成对的数据,在函数执行过程中处于激活(即可访问)状态; 闭包在函数运行结束后,保持运行过程的最终数据状态。 总的来说,函数闭包决定了:闭包所对应的函数代码如何访问数据,以及闭包内的数据何时销毁。 // 没有函数实例产生 function myFunc(){ } var f1 = myFunc; var f2 = myFunc; alert(f1 === f2)...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepaddingme
hostnamegithub.com
expected-hostnamegithub.com
None9a0797c11799dbfd7df57fa3de31c7ea3a4c4bd055eb1a0427a5cde1d4d7ba3f
turbo-cache-controlno-preview
go-importgithub.com/paddingme/Learning-JavaScript git https://github.com/paddingme/Learning-JavaScript.git
octolytics-dimension-user_id5771087
octolytics-dimension-user_loginpaddingme
octolytics-dimension-repository_id25473884
octolytics-dimension-repository_nwopaddingme/Learning-JavaScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id25473884
octolytics-dimension-repository_network_root_nwopaddingme/Learning-JavaScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb099d96da147aea31036cd16b2fba0083a6defe4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/paddingme/Learning-JavaScript/issues/29#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F29
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F29
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=paddingme%2FLearning-JavaScript
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/29
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/29
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/29
paddingme https://github.com/paddingme
Learning-JavaScripthttps://github.com/paddingme/Learning-JavaScript
Notifications https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Fork 13 https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Star 28 https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Code https://github.com/paddingme/Learning-JavaScript
Issues 30 https://github.com/paddingme/Learning-JavaScript/issues
Pull requests 0 https://github.com/paddingme/Learning-JavaScript/pulls
Actions https://github.com/paddingme/Learning-JavaScript/actions
Projects https://github.com/paddingme/Learning-JavaScript/projects
Wiki https://github.com/paddingme/Learning-JavaScript/wiki
Security and quality 0 https://github.com/paddingme/Learning-JavaScript/security
Insights https://github.com/paddingme/Learning-JavaScript/pulse
Code https://github.com/paddingme/Learning-JavaScript
Issues https://github.com/paddingme/Learning-JavaScript/issues
Pull requests https://github.com/paddingme/Learning-JavaScript/pulls
Actions https://github.com/paddingme/Learning-JavaScript/actions
Projects https://github.com/paddingme/Learning-JavaScript/projects
Wiki https://github.com/paddingme/Learning-JavaScript/wiki
Security and quality https://github.com/paddingme/Learning-JavaScript/security
Insights https://github.com/paddingme/Learning-JavaScript/pulse
闭包https://github.com/paddingme/Learning-JavaScript/issues/29#top
https://github.com/paddingme
paddingmehttps://github.com/paddingme
on Aug 22, 2015https://github.com/paddingme/Learning-JavaScript/issues/29#issue-102518224
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.