René's URL Explorer Experiment


Title: 【JavaScript】【学习心得】学习 JavaScript 第十六天 · Issue #20 · paddingme/Learning-JavaScript · GitHub

Open Graph Title: 【JavaScript】【学习心得】学习 JavaScript 第十六天 · Issue #20 · paddingme/Learning-JavaScript

X Title: 【JavaScript】【学习心得】学习 JavaScript 第十六天 · Issue #20 · paddingme/Learning-JavaScript

Description: JavaScript 简介 JavaScript 的兴起,主要目的是处理以前由服务器端语言负责的一些输入验证操作,如今,JavaScript 已不再局限于简单的数据验证,而是具备了与浏览器窗口及其内容等几乎所有方面交互的能力。今天JavaScript 已经成为一门功能全面的编程语言,能够处理复杂的计算和交互,拥有了 闭包、匿名函数、甚至 元编程等特性。 一个完整的JavaScript 实现通常有三部分组成: 核心(ECMAScript),由 ECMA-262 定义,提供...

Open Graph Description: JavaScript 简介 JavaScript 的兴起,主要目的是处理以前由服务器端语言负责的一些输入验证操作,如今,JavaScript 已不再局限于简单的数据验证,而是具备了与浏览器窗口及其内容等几乎所有方面交互的能力。今天JavaScript 已经成为一门功能全面的编程语言,能够处理复杂的计算和交互,拥有了 闭包、匿名函数、甚至 元编程等特性。 一个完整的JavaScript 实现通...

X Description: JavaScript 简介 JavaScript 的兴起,主要目的是处理以前由服务器端语言负责的一些输入验证操作,如今,JavaScript 已不再局限于简单的数据验证,而是具备了与浏览器窗口及其内容等几乎所有方面交互的能力。今天JavaScript 已经成为一门功能全面的编程语言,能够处理复杂的计算和交互,拥有了 闭包、匿名函数、甚至 元编程等特性。 一个完整的JavaScript 实现通...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"【JavaScript】【学习心得】学习 JavaScript 第十六天","articleBody":"## JavaScript 简介\n\nJavaScript 的兴起,主要目的是处理以前由服务器端语言负责的一些输入验证操作,如今,JavaScript 已不再局限于简单的数据验证,而是具备了与浏览器窗口及其内容等几乎所有方面交互的能力。今天JavaScript 已经成为一门功能全面的编程语言,能够处理复杂的计算和交互,拥有了 **闭包**、**匿名函数**、甚至 **元编程**等特性。\n\n一个完整的JavaScript 实现通常有三部分组成:\n- 核心(ECMAScript),由 ECMA-262 定义,提供核心语言功能;\n- 文档浏览器模型(DOM),提供访问和操作网页内容的方法和接口;\n- 浏览器对象模型(BOM),提供与浏览器交互的方法和接口。\n  我们常见的 Web 浏览器只是 ECMAScript 实现可能的 _宿主环境_之一。而Web 浏览器对DOM的支持,对于IE来说,IE 5.5 支持 DOM 1 级。在随后的 IE6、IE7中没有引入新的 DOM 功能,直到 IE8 才对以前 DOM 实现中的 bug 进行修复。\n## 在HTML 中使用JavaScript\n\nHTML4.01为`\u003cscript\u003e`定义了6个属性(废弃的这里不再给出):\n- async: 可选,表示应该立即下载脚本,但不应妨碍页面中的其他操作;\n- defer: 可选,表示脚本可以延迟到文档完全被解析和显示之后再执行,只对外部脚本有效;\n- src: 可选,外部脚本文件;\n-  type: 可选,表示编写代码使用的脚本语言的内容类型(MIME),通常为 text/javascript ,默认也为 text/javascript。\n\n使用`\u003cjavascript\u003e`元素有两种方式:\n- 直接在页面嵌入 JavaScript 代码;\n- 包含外部 JavaScript 文件。\n\n包含在`\u003cscript\u003e`元素内部的JavaScript 代码将从上至下依次解释。在解释器 `\u003cscript\u003e` 元素内部的所有的代码求值完毕以前,页面中的其余内容将不会被浏览器加载或显示。\n\n在使用`\u003cscript\u003e`嵌入 Javascript 代码时,记住不要在代码的任何地方出现 `\"\u003c/script\u003e\"`字符串,浏览器会认为这是结束的`\u003c/script\u003e`标签。\n\n无论如何包含代码,只要不存在`defer`或者`async`属性,浏览器都会按照`\u003cscript\u003e`元素所在页面中出现的先后顺序对它们依次进行解析。\n\n`defer`属性只适用于外部脚本文件,现实中,延迟脚本并不一定会按照顺序进行(第一个延迟脚本先于第二个延迟脚本执行),也不一定会在 DOMContentLoaded 事件触发前执行,因为最好只包含一个延迟脚本。\n\n异步脚本同样只适用于外部脚本文件,并告诉浏览器立即下载文件,异步脚本并不保证按照它们的先后顺序执行。 异步脚本一定会在页面的load 事件前执行,但可能会在 DOMContentLoaded 事件触发之前或之后执行。\n\n``` html\n    \u003c!DOCTYPE html\u003e\n    \u003chtml lang=\"zh-CN\"\u003e\n    \u003chead\u003e\n        \u003cmeta charset=\"UTF-8\"\u003e\n        \u003ctitle\u003eDocument\u003c/title\u003e\n        \u003cscript type=\"text/javascript\" defer=\"defer\" src=\"example.js\"\u003e\u003c/script\u003e\n        \u003cscript type=\"text/javascript\" async src=\"example.js\"\u003e\u003c/script\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003cnoscript\u003e\n         \u003cp\u003e本页面需要浏览器支持 JavaScript!\u003c/p\u003e\n        \u003c/noscript\u003e\n    \u003c/body\u003e\n    \u003c/html\u003e\n```\n\n适用外部脚本文件通常会有如下优点:\n- 易于维护\n- 可缓存\n- 适应未来(不需要hack)\n## 数据类型\n### 标识符\n\n所谓标识符,就是指变量、函数、属性的名字,或者函数的参数。标识符可以是按照下列格式规则组合起来的一个或多个字符:\n- 第一个字符必须是一个字母、下划线、或者一个美元符号;\n- 其他字符可以是字母、下划线、美元符号或者数字。\n### 变量\n\nECMAScript 的变量是松散的,所谓松散类型就是可以用来保存任何类型的数据,亦即每个变量仅仅是一个用于保存值的占位符而已。\n### 数据类型\n\nECMAScript 中有五种简单数据类型:**Undefined**、 **Null**、 **Number**、 **String**、 **Boolean**。\n还有一种复杂数据类型:**Obejct**。\n#### typeof\n\n`typeof` 用来检测给定变量的数据类型,对一个值使用`typeof`操作符可能返回如下字符串:\n- \"undefined\"——值未定义;\n- \"boolean\"——布尔值;\n- \"string\"——字符串;\n-  \"number\"——数字;\n-  \"object\"——对象或者null(空指针);\n-  \"function\"——函数。\n\n``` js\nconsole.log(typeof null);//\"object\"\n```\n\n特殊值`null`被认为是一个空的对象引用。Safari 以及之前版本、Chrome 7以及之前版本对正则表达式跳动 `typeof` 返回 \"function\",而其他浏览器返回 \"object\"。\n#### Undefined\n\n对于尚未声明过的变量,只能执行一项操作,即是对其使用`typeof`操作符检验器数据类型。\n\n对未初始化过的变量执行`typeof` 返回\"undefied\";而对未声明过的变量执行也返回\"undefined\".\n#### Null\n\n如果定义的变量准备在将来用于保存对象,那么最好将该变量初始化为`null`。\n#### Boolean\n\n| 数据类型 | 转换为true 的值 | 转换为false 的值 |\n| --- | --- | --- |\n| Boolean | true | false |\n| String | 任何非空字符串 | \"\"(空字符串) |\n| Number | 任何非零数字包含无穷大 | 0和NaN |\n| Object | 任何对象 | null |\n| Undefined |  | undefined |\n#### Number\n1. 浮点数\n   \n   所谓浮点数,是指该数值中必须包含一个小数点,且小数点后面必须至少有一位数字。如果浮点数本身就是一个整数(如1.0),那么该值将被转换为整数。\n   \n   浮点数值的最高精度是17位小数,但在进行算术计算时其精确度远远不如整数,例如0.1+0.2结果不是0.3而是0.30000000000000004,如果这两个数是0.15+0.15或者0.25+0.05则没有问题。\n2. 数值范围\n   \n   数值范围为Infinity 和 -Infinity,可使用 isFinite() 函数检测。\n3. NaN\n   \n   任何值除以0都会返回 NaN(not a number) ,任何涉及NaN 的操作都返回 NaN,其次 NaN 与任何值都不相等, 包括 NaN 本身。 isNaN()函数进行检测,在接收一个数值之后会尝试进行转换为数值,某些不是数值的值会被转换为数值,如\"10\"或布尔值,任何不能被转换为数值的值则返回true。\n   \n   isNaN 也适用于对象,在基于对象调用 isNaN() 函数时, 会首先调用对象的 valueOf() 方法, 然后确定该方法返回的值是否可以转换为数值,如果不能,则基于这个返回值再调用 toString() 方法,再测试返回值。\n4. 数值转换\n   \n   有三个函数可以把非数值转换为数值: Number()、 parsetInt()、 parseFloat()。\n   Number() 可以用于任何数据类型,而另外两个专门用于字符串转换成数值。\n   \n   Number() 转换规则:\n   - 如是 Boolean, 转换为0或1;\n   - 若是数字值,转换为数字值;\n   - 若是null, 返回0;\n   - 若是undefined, 返回 NaN;\n   - 若是字符串,则:\n     - 若字符串只包含数字(包含带正号或负号的情况),则将其转换为十进制数值。\n     - 若字符串包含有效的浮点数,转换为相应的浮点数。\n     - 若包含有效的十六进制数,转换为相同大小的十进制数。\n     - 若为空字符串,转换为0。\n     - 若字符串包含上述, 则格式之外的字符,转换为 NaN 。\n   - 若是对象,则调用 valueOf()方法,然后按照前面的方法返回值,若转换结果为 NaN,则调用对象的 toString() 方法,然后在依照前面的规则返回相应的字符串值。\n   \n   parseInt() 函数在转换字符串时,会忽略字符串前面的空格, 直至找到第一个非空字符。如果第一个字符不是数字字符或者符号,则返回NaN,亦即`parseInt(\"\")`返回NaN,若第一个字符是数字则继续解析第二个,知道解析玩所有后续字符或者遇到非数字字符。parseInt()后还可以跟一个参数,转换时使用的基数(2,8,10,16)。\n   \n   parseFloat() 始终忽略前导的零。十六进制的始终会被转换为0,只解析十进制。\n#### String\n\n任何字符串的长度都可以通过访问它的length 属性取得。\n\n字符串一段创建,他们的值就不可以改变。要改变某个变量保存的字符串,首先要销毁原来的字符串,然后再用另一个包含新值的字符串填充该变量。\n\n转换为字符串:每个值都有一个 toString()方法,但null 和undefined 没有。也可以传参数改变原来的值;还可以使用String()方法,其转换规则为:\n- 若值有toString()方法,则调用该方法返回值;\n- 若值为null,返回\"null\";\n- 若值为undefined,返回\"undefined\"。\n","author":{"url":"https://github.com/paddingme","@type":"Person","name":"paddingme"},"datePublished":"2014-12-02T14:20:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/20/Learning-JavaScript/issues/20"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c649e286-9a51-288b-afed-4f45551928ea
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE9BE:26FD39:6F521F8:992AA5A:6A5EA973
html-safe-noncefd68457b593b3d24807585c720cd8064dc5192c1b3aa450feecca827bb16e3ee
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUJFOjI2RkQzOTo2RjUyMUY4Ojk5MkFBNUE6NkE1RUE5NzMiLCJ2aXNpdG9yX2lkIjoiNTc2MDEwODE0Mjg0OTMzNzcxNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf1b3e75abd7f12b6ef57c19c8a83427abd7b1db4103c36e91de66e65399dd9bf
hovercard-subject-tagissue:50655794
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/20/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fcf4a5d1936c859f0947bdc70c9db93f3a77bdbb93b2e5da97b6ef27a937cf17/paddingme/Learning-JavaScript/issues/20
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fcf4a5d1936c859f0947bdc70c9db93f3a77bdbb93b2e5da97b6ef27a937cf17/paddingme/Learning-JavaScript/issues/20
og:image:altJavaScript 简介 JavaScript 的兴起,主要目的是处理以前由服务器端语言负责的一些输入验证操作,如今,JavaScript 已不再局限于简单的数据验证,而是具备了与浏览器窗口及其内容等几乎所有方面交互的能力。今天JavaScript 已经成为一门功能全面的编程语言,能够处理复杂的计算和交互,拥有了 闭包、匿名函数、甚至 元编程等特性。 一个完整的JavaScript 实现通...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepaddingme
hostnamegithub.com
expected-hostnamegithub.com
None7c7e31acb6a895494e518b880f5ccf39604f7fa9a8f2f3c64145efc3b776256d
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
release2d2ac9bdd71d5f53f2b731c9330677e38624e301
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/paddingme/Learning-JavaScript/issues/20#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F20
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%2F20
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/20
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/20
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/20
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
【JavaScript】【学习心得】学习 JavaScript 第十六天https://github.com/paddingme/Learning-JavaScript/issues/20#top
Mu-Help-Planhttps://github.com/paddingme/Learning-JavaScript/issues?q=state%3Aopen%20label%3A%22Mu-Help-Plan%22
https://github.com/paddingme
paddingmehttps://github.com/paddingme
on Dec 2, 2014https://github.com/paddingme/Learning-JavaScript/issues/20#issue-50655794
Mu-Help-Planhttps://github.com/paddingme/Learning-JavaScript/issues?q=state%3Aopen%20label%3A%22Mu-Help-Plan%22
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.