René's URL Explorer Experiment


Title: this那篇习题答案有误 · javascript-tutorial/zh.javascript.info · Discussion #1062 · GitHub

Open Graph Title: this那篇习题答案有误 · javascript-tutorial/zh.javascript.info · Discussion #1062

X Title: this那篇习题答案有误 · javascript-tutorial/zh.javascript.info · Discussion #1062

Description: this那篇习题答案有误

Open Graph Description: 在this那篇教程上说下方代码是会报错 因为this是undefined 但是实际不会 function makeUser() { return { name: "John", ref: this }; } let user = makeUser(); alert(user.ref.age);

X Description: 在this那篇教程上说下方代码是会报错 因为this是undefined 但是实际不会 function makeUser() { return { name: "John", ref: this }; } let user = makeUser(); alert(user.ref.age);

Opengraph URL: https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"this那篇习题答案有误","text":"
   在this那篇教程上说下方代码是会报错 因为this是undefined 但是实际不会\n
\n

function makeUser() {
\nreturn {
\nname: \"John\",
\nref: this
\n};
\n}

\n
    let user = makeUser();\n\n    alert(user.ref.age);\n
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Hello,本教程已经说明

\n
\n

本教程的所有例子都默认采用严格模式,除非特别指定(非常少)。

\n
\n

在严格模式下 global 不会把 this 设置为 globalThis,而是为 undefined

\n

P.S. 同时可以把这个理解为默认行为,因为在现代前端开发绝大部分上下文都是暗含了开启严格模式的。

","upvoteCount":1,"url":"https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussioncomment-2980845"}}}

route-pattern/_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format)
route-controllervoltron_discussions_fragments
route-actiondiscussion_layout
fetch-noncev2:b2257185-2344-9e4d-97bb-9c25ff9af971
current-catalog-service-hash9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be
request-idA246:236F3C:7BEBC5:AB0AF5:696A8002
html-safe-noncea0d865ed01391be02e4c86a6bcea9b2a001c9850ff0056e19bbb6faee2663f2c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjQ2OjIzNkYzQzo3QkVCQzU6QUIwQUY1OjY5NkE4MDAyIiwidmlzaXRvcl9pZCI6IjIwNzI3Mzg4OTIyNjIwNDc3NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac07e4bd1a087d753bcfd0dcab5b276efc53f7dfc0b54658a16e066af6e2a09606
hovercard-subject-tagdiscussion:4157420
github-keyboard-shortcutsrepository,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/discussions_fragments/discussion_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/javascript-tutorial/zh.javascript.info/1062/discussion_layout
twitter:imagehttps://opengraph.githubassets.com/317a940a5737ed3cf079b55cf3694c53d91e3c5a246800096ce4af11dd896863/javascript-tutorial/zh.javascript.info/discussions/1062
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/317a940a5737ed3cf079b55cf3694c53d91e3c5a246800096ce4af11dd896863/javascript-tutorial/zh.javascript.info/discussions/1062
og:image:alt在this那篇教程上说下方代码是会报错 因为this是undefined 但是实际不会 function makeUser() { return { name: "John", ref: this }; } let user = makeUser(); alert(user.ref.age);
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None913560fa317c3c5a71e34f9b19253c9f09d02b4b958a86c2a56f4c8541116377
turbo-cache-controlno-preview
go-importgithub.com/javascript-tutorial/zh.javascript.info git https://github.com/javascript-tutorial/zh.javascript.info.git
octolytics-dimension-user_id49552305
octolytics-dimension-user_loginjavascript-tutorial
octolytics-dimension-repository_id128014656
octolytics-dimension-repository_nwojavascript-tutorial/zh.javascript.info
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id128014656
octolytics-dimension-repository_network_root_nwojavascript-tutorial/zh.javascript.info
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
release5998c30593994bf2589055aef7b22d368a499367
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fjavascript-tutorial%2Fzh.javascript.info%2Fdiscussions%2F1062
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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/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%2Fjavascript-tutorial%2Fzh.javascript.info%2Fdiscussions%2F1062
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%2Fdiscussions_fragments%2Fdiscussion_layout&source=header-repo&source_repo=javascript-tutorial%2Fzh.javascript.info
Reloadhttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
Reloadhttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
Reloadhttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
javascript-tutorial https://github.com/javascript-tutorial
zh.javascript.infohttps://github.com/javascript-tutorial/zh.javascript.info
Notifications https://github.com/login?return_to=%2Fjavascript-tutorial%2Fzh.javascript.info
Fork 1.2k https://github.com/login?return_to=%2Fjavascript-tutorial%2Fzh.javascript.info
Star 10.6k https://github.com/login?return_to=%2Fjavascript-tutorial%2Fzh.javascript.info
Code https://github.com/javascript-tutorial/zh.javascript.info
Issues 12 https://github.com/javascript-tutorial/zh.javascript.info/issues
Pull requests 16 https://github.com/javascript-tutorial/zh.javascript.info/pulls
Discussions https://github.com/javascript-tutorial/zh.javascript.info/discussions
Actions https://github.com/javascript-tutorial/zh.javascript.info/actions
Wiki https://github.com/javascript-tutorial/zh.javascript.info/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/javascript-tutorial/zh.javascript.info/security
Please reload this pagehttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
Insights https://github.com/javascript-tutorial/zh.javascript.info/pulse
Code https://github.com/javascript-tutorial/zh.javascript.info
Issues https://github.com/javascript-tutorial/zh.javascript.info/issues
Pull requests https://github.com/javascript-tutorial/zh.javascript.info/pulls
Discussions https://github.com/javascript-tutorial/zh.javascript.info/discussions
Actions https://github.com/javascript-tutorial/zh.javascript.info/actions
Wiki https://github.com/javascript-tutorial/zh.javascript.info/wiki
Security https://github.com/javascript-tutorial/zh.javascript.info/security
Insights https://github.com/javascript-tutorial/zh.javascript.info/pulse
Answered https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussioncomment-2980845
songhn233https://github.com/songhn233
xiaowangge666 https://github.com/xiaowangge666
Q&Ahttps://github.com/javascript-tutorial/zh.javascript.info/discussions/categories/q-a
this那篇习题答案有误 https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#top
xiaowangge666 https://github.com/xiaowangge666
Answered https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussioncomment-2980845
songhn233https://github.com/songhn233
Return to tophttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#top
Please reload this pagehttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
xiaowangge666 https://github.com/xiaowangge666
Jun 19, 2022 https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussion-4157420
Give feedback.https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
songhn233 https://github.com/songhn233
Jun 19, 2022 https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussioncomment-2980845
说明https://zh.javascript.info/strict-mode#wo-men-ying-gai-shi-yong-usestrict-ma
View full answer https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussioncomment-2980845
Oldest https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062?sort=old
Newest https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062?sort=new
Top https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062?sort=top
Please reload this pagehttps://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
songhn233 https://github.com/songhn233
Jun 19, 2022 https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062#discussioncomment-2980845
说明https://zh.javascript.info/strict-mode#wo-men-ying-gai-shi-yong-usestrict-ma
Give feedback.https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
songhn233https://github.com/songhn233
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fjavascript-tutorial%2Fzh.javascript.info%2Fdiscussions%2F1062
🙏 Q&A https://github.com/javascript-tutorial/zh.javascript.info/discussions/categories/q-a
https://github.com/xiaowangge666
https://github.com/songhn233
#1061https://github.com/javascript-tutorial/zh.javascript.info/issues/1061
https://github.com/javascript-tutorial/zh.javascript.info/discussions/1062
https://github.com/settings/replies?return_to=1
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.