René's URL Explorer Experiment


Title: CodingStyle/JavaScript.md at master · shjborage/CodingStyle · GitHub

Open Graph Title: CodingStyle/JavaScript.md at master · shjborage/CodingStyle

X Title: CodingStyle/JavaScript.md at master · shjborage/CodingStyle

Description: 各语言编码规范. Contribute to shjborage/CodingStyle development by creating an account on GitHub.

Open Graph Description: 各语言编码规范. Contribute to shjborage/CodingStyle development by creating an account on GitHub.

X Description: 各语言编码规范. Contribute to shjborage/CodingStyle development by creating an account on GitHub.

Mail addresses
shjborage@gmail.com
shjborage@gmail.com

Opengraph URL: https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/blob/*name(/*path)
route-controllerblob
route-actionshow
fetch-noncev2:36e3cba2-9ee2-a178-0193-5ac203b52be9
current-catalog-service-hashf3abb0cc802f3d7b95fc8762b94bdcb13bf39634c40c357301c4aa1d67a256fb
request-idE856:FB1CA:88330B:BC04D0:6A4DB67A
html-safe-nonce68c5d643b10c70e0385b58e37b3f91e2b995fb51f1fe080491dbe4c0b991e1bc
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODU2OkZCMUNBOjg4MzMwQjpCQzA0RDA6NkE0REI2N0EiLCJ2aXNpdG9yX2lkIjoiNjQ1MTg2ODY4Mzc4MjE3NDMzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac477a4dd001ca2fcd5649d7c977d596df4f81545a97f2bab6dd468c6d6d9c2c3b
hovercard-subject-tagrepository:60579394
github-keyboard-shortcutsrepository,source-code,file-tree,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///blob/show
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md
twitter:imagehttps://opengraph.githubassets.com/27f7be20daa32f14c5d25fa1bf72fc67cc2ee325d0e3ffac9518709ec01c0d82/shjborage/CodingStyle
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/27f7be20daa32f14c5d25fa1bf72fc67cc2ee325d0e3ffac9518709ec01c0d82/shjborage/CodingStyle
og:image:alt各语言编码规范. Contribute to shjborage/CodingStyle development by creating an account on GitHub.
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33
turbo-cache-controlno-cache
go-importgithub.com/shjborage/CodingStyle git https://github.com/shjborage/CodingStyle.git
octolytics-dimension-user_id1191870
octolytics-dimension-user_loginshjborage
octolytics-dimension-repository_id60579394
octolytics-dimension-repository_nwoshjborage/CodingStyle
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id60579394
octolytics-dimension-repository_network_root_nwoshjborage/CodingStyle
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
release32f7b614aca06e6bbd89842b1370df1328264f68
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fshjborage%2FCodingStyle%2Fblob%2Fmaster%2FJavaScript.md
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
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/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/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/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%2Fshjborage%2FCodingStyle%2Fblob%2Fmaster%2FJavaScript.md
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%2Fblob%2Fshow&source=header-repo&source_repo=shjborage%2FCodingStyle
Reloadhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md
Reloadhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md
Reloadhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md
shjborage https://github.com/shjborage
CodingStylehttps://github.com/shjborage/CodingStyle
Notifications https://github.com/login?return_to=%2Fshjborage%2FCodingStyle
Fork 27 https://github.com/login?return_to=%2Fshjborage%2FCodingStyle
Star 77 https://github.com/login?return_to=%2Fshjborage%2FCodingStyle
Code https://github.com/shjborage/CodingStyle
Issues 0 https://github.com/shjborage/CodingStyle/issues
Pull requests 1 https://github.com/shjborage/CodingStyle/pulls
Actions https://github.com/shjborage/CodingStyle/actions
Projects https://github.com/shjborage/CodingStyle/projects
Security and quality 0 https://github.com/shjborage/CodingStyle/security
Insights https://github.com/shjborage/CodingStyle/pulse
Code https://github.com/shjborage/CodingStyle
Issues https://github.com/shjborage/CodingStyle/issues
Pull requests https://github.com/shjborage/CodingStyle/pulls
Actions https://github.com/shjborage/CodingStyle/actions
Projects https://github.com/shjborage/CodingStyle/projects
Security and quality https://github.com/shjborage/CodingStyle/security
Insights https://github.com/shjborage/CodingStyle/pulse
https://github.com/shjborage/CodingStyle
CodingStylehttps://github.com/shjborage/CodingStyle/tree/master
Historyhttps://github.com/shjborage/CodingStyle/commits/master/JavaScript.md
https://github.com/shjborage/CodingStyle/commits/master/JavaScript.md
CodingStylehttps://github.com/shjborage/CodingStyle/tree/master
Rawhttps://github.com/shjborage/CodingStyle/raw/refs/heads/master/JavaScript.md
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#javascript-coding-style
1 前言https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#1-%E5%89%8D%E8%A8%80
2 代码风格https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2-%E4%BB%A3%E7%A0%81%E9%A3%8E%E6%A0%BC
2.1 文件https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#21-%E6%96%87%E4%BB%B6
2.2 结构https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#22-%E7%BB%93%E6%9E%84
2.2.1 缩进https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#221-%E7%BC%A9%E8%BF%9B
2.2.2 空格https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#222-%E7%A9%BA%E6%A0%BC
2.2.3 换行https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#223-%E6%8D%A2%E8%A1%8C
2.2.4 语句https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#224-%E8%AF%AD%E5%8F%A5
2.3 命名https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#23-%E5%91%BD%E5%90%8D
2.4 注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#24-%E6%B3%A8%E9%87%8A
2.4.1 单行注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#241-%E5%8D%95%E8%A1%8C%E6%B3%A8%E9%87%8A
2.4.2 多行注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#242-%E5%A4%9A%E8%A1%8C%E6%B3%A8%E9%87%8A
2.4.3 文档化注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#243-%E6%96%87%E6%A1%A3%E5%8C%96%E6%B3%A8%E9%87%8A
2.4.4 类型定义https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#244-%E7%B1%BB%E5%9E%8B%E5%AE%9A%E4%B9%89
2.4.5 文件注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#245-%E6%96%87%E4%BB%B6%E6%B3%A8%E9%87%8A
2.4.6 命名空间注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#246-%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E6%B3%A8%E9%87%8A
2.4.7 类注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#247-%E7%B1%BB%E6%B3%A8%E9%87%8A
2.4.8 函数/方法注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#248-%E5%87%BD%E6%95%B0/%E6%96%B9%E6%B3%95%E6%B3%A8%E9%87%8A
2.4.9 事件注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#249-%E4%BA%8B%E4%BB%B6%E6%B3%A8%E9%87%8A
2.4.10 常量注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2410-%E5%B8%B8%E9%87%8F%E6%B3%A8%E9%87%8A
2.4.11 复杂类型注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2411-%E5%A4%8D%E6%9D%82%E7%B1%BB%E5%9E%8B%E6%B3%A8%E9%87%8A
2.4.12 AMD 模块注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2412-amd-%E6%A8%A1%E5%9D%97%E6%B3%A8%E9%87%8A
2.4.13 细节注释https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2413-%E7%BB%86%E8%8A%82%E6%B3%A8%E9%87%8A
3 语言特性https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3-%E8%AF%AD%E8%A8%80%E7%89%B9%E6%80%A7
3.1 变量https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#31-%E5%8F%98%E9%87%8F
3.2 条件https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#32-%E6%9D%A1%E4%BB%B6
3.3 循环https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#33-%E5%BE%AA%E7%8E%AF
3.4 类型https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#34-%E7%B1%BB%E5%9E%8B
3.4.1 类型检测https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#341-%E7%B1%BB%E5%9E%8B%E6%A3%80%E6%B5%8B
3.4.2 类型转换https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#342-%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2
3.5 字符串https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#35-%E5%AD%97%E7%AC%A6%E4%B8%B2
3.6 对象https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#36-%E5%AF%B9%E8%B1%A1
3.7 数组https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#37-%E6%95%B0%E7%BB%84
3.8 函数https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#38-%E5%87%BD%E6%95%B0
3.8.1 函数长度https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#381-%E5%87%BD%E6%95%B0%E9%95%BF%E5%BA%A6
3.8.2 参数设计https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#382-%E5%8F%82%E6%95%B0%E8%AE%BE%E8%AE%A1
3.8.3 闭包https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#383-%E9%97%AD%E5%8C%85
3.8.4 空函数https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#384-%E7%A9%BA%E5%87%BD%E6%95%B0
3.9 面向对象https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#39-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1
3.10 动态特性https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#310-%E5%8A%A8%E6%80%81%E7%89%B9%E6%80%A7
3.10.1 evalhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3101-eval
3.10.2 动态执行代码https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3102-%E5%8A%A8%E6%80%81%E6%89%A7%E8%A1%8C%E4%BB%A3%E7%A0%81
3.10.3 withhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3103-with
3.10.4 deletehttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3104-delete
3.10.5 对象属性https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3105-%E5%AF%B9%E8%B1%A1%E5%B1%9E%E6%80%A7
4 浏览器环境https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#4-%E6%B5%8F%E8%A7%88%E5%99%A8%E7%8E%AF%E5%A2%83
4.1 模块化https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#41-%E6%A8%A1%E5%9D%97%E5%8C%96
4.1.1 AMDhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#411-amd
4.1.2 definehttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#412-define
4.1.3 requirehttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#413-require
4.2 DOMhttps://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#42-dom
4.2.1 元素获取https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#421-%E5%85%83%E7%B4%A0%E8%8E%B7%E5%8F%96
4.2.2 样式获取https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#422-%E6%A0%B7%E5%BC%8F%E8%8E%B7%E5%8F%96
4.2.3 样式设置https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#423-%E6%A0%B7%E5%BC%8F%E8%AE%BE%E7%BD%AE
4.2.4 DOM 操作https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#424-dom-%E6%93%8D%E4%BD%9C
4.2.5 DOM 事件https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#425-dom-%E4%BA%8B%E4%BB%B6
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#1-前言
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2-代码风格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#21-文件
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-javascript-文件使用无-bom-的-utf-8-编码
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-在文件结尾处保留一个空行
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#22-结构
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#221-缩进
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-使用-4-个空格做为一个缩进层级不允许使用-2-个空格-或-tab-字符
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-switch-下的-case-和-default-必须增加一个缩进层级
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#222-空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-二元运算符两侧必须有一个空格一元运算符与操作对象之间不允许有空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-if--else-关键字必须成对出现如果有-else-if-也必须有-else-保证所有分支都得到处理
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-用作代码块起始的左花括号--前必须有一个空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-if--else--for--while--function--switch--do--try--catch--finally-关键字后必须有一个空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-在对象创建时属性中的--之后必须有空格-之前不允许有空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-函数声明具名函数表达式函数调用中函数名和--之间不允许有空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制--和--前不允许有空格如果不位于行尾-和--后必须跟一个空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-在函数调用函数声明括号表达式属性访问if--for--while--switch--catch-等语句中-和--内紧贴括号部分不允许有空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-单行声明的数组与对象如果包含元素-和--内紧贴括号部分不允许包含空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-行尾不得有多余的空格
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#223-换行
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-每个独立语句结束后必须换行
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-每行不得超过-120-个字符
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-运算符处换行时运算符必须在新行的行首
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-在函数声明函数表达式函数调用对象创建数组创建for-语句等场景中不允许在--或--前换行
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-不同行为或逻辑的语句集使用空行隔开更易阅读
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-在语句的行长度超过-120-时根据逻辑条件合理缩进
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于-ifelsetrycatchfinally-等语句推荐使用在--号后添加一个换行-的风格使代码层次结构更清晰阅读性更好
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#224-语句
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-不得省略语句结束的分号
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-在-if--else--for--do--while-语句中即使只有一行也不得省略块-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-函数定义结束不允许添加分号
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-iife-必须在函数表达式外添加-非-iife-不得在函数表达式外添加-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#23-命名
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-变量-使用-camel命名法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-常量-使用-全部字母大写单词间下划线分隔-的命名方式
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-函数-使用-camel命名法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-函数的-参数-使用-camel命名法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-类-使用-pascal命名法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-类的-方法--属性-使用-camel命名法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-枚举变量-使用-pascal命名法枚举的属性-使用-全部字母大写单词间下划线分隔-的命名方式
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-命名空间-使用-camel命名法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-由多个单词组成的缩写词在命名中根据当前命名法和出现的位置所有字母的大小写与首字母的大小写保持一致
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-类名-使用-名词
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-函数名-使用-动宾短语
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-boolean-类型的变量使用-is-或-has-开头
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-promise对象-用-动宾短语的进行时-表达
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#24-注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#241-单行注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-必须独占一行-后跟一个空格缩进与下一行被注释说明的代码一致
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#242-多行注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-避免使用--这样的多行注释有多行注释内容时使用多个单行注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#243-文档化注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-为了便于代码阅读和自文档化以下内容必须包含以--形式的块注释中
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-文档注释前必须空一行
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-自文档化的文档说明-what而不是-how
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#244-类型定义
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-类型定义都是以--开始-以--结束
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-对于基本类型-string-number-boolean首字母必须小写
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#245-文件注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-文件顶部必须包含文件注释用-file-标识文件说明
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-文件注释中可以用-author-标识开发者信息
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#246-命名空间注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-命名空间使用-namespace-标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#247-类注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-class-标记类或构造函数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-extends-标记类的继承信息
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-使用包装方式扩展类成员时-必须通过-lends-进行重新指向
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-类的属性或方法等成员信息使用-public--protected--private-中的任意一个指明可访问性
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#248-函数方法注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-函数方法注释必须包含函数说明有参数和返回值时必须使用注释标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-参数和返回值注释必须包含类型信息且不允许省略参数的说明
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-当函数是内部函数外部不可访问时可以使用-inner-标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-对-object-中各项的描述-必须使用-param-标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-重写父类方法时-应当添加-override-标识如果重写的形参个数类型顺序和返回值类型均未发生变化可省略-paramreturn仅用-override-标识否则仍应作完整注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#249-事件注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-必须使用-event-标识事件事件参数的标识与方法描述的参数标识相同
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-在会广播事件的函数前使用-fires-标识广播的事件在广播事件代码前使用-event-标识事件
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于事件对象的注释使用-param-标识生成文档时可读性更好
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2410-常量注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-常量必须使用-const-标记并包含说明和类型信息
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2411-复杂类型注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于类型未定义的复杂结构的注释可以使用-typedef-标识来定义
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2412-amd-模块注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-amd-模块使用-module-或-exports-标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-对于已使用-module-标识为-amd模块-的引用在-namepaths-中必须增加-module-作前缀
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于类定义的模块可以使用-alias-标识构建函数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-多模块定义时可以使用-exports-标识各个模块
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于-exports-为-object-的模块可以使用namespace标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于-exports-为类名的模块使用-class-和-exports-标识
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#2413-细节注释
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-细节注释遵循单行注释的格式说明必须换行时每行是一个单行注释的起始
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-有时我们会使用一些特殊标记进行说明特殊标记必须使用单行注释的形式下面列举了一些常用标记
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3-语言特性
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#31-变量
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-变量函数在使用前必须先定义
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-每个-var-只能声明一个变量
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-变量必须-即用即声明不得在函数或其它形式的代码块起始位置统一声明所有变量
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#32-条件
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-在-equality-expression-中使用类型严格的-仅当判断-null-或-undefined-时允许使用--null
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-尽可能使用简洁的表达式
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-按执行频率排列分支的顺序
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于相同变量或表达式的多值条件用-switch-代替-if
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-如果函数或全局中的-else-块后没有任何语句可以删除-else
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#33-循环
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-不要在循环体中包含函数表达式事先将函数提取到循环体外
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对循环内多次使用的不变值在循环外用变量缓存
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对有序集合进行遍历时缓存-length
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对有序集合进行顺序无关的遍历时使用逆序遍历
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#34-类型
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#341-类型检测
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-类型检测优先使用-typeof对象类型检测使用-instanceofnull-或-undefined-的检测使用--null
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#342-类型转换
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-转换成-string-时使用--
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-转换成-number-时通常使用-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-string-转换成-number要转换的字符串结尾包含非数字并期望忽略时使用-parseint
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-使用-parseint-时必须指定进制
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-转换成-boolean-时使用-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-number-去除小数点使用-mathfloor--mathround--mathceil不使用-parseint
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#35-字符串
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-字符串开头和结束使用单引号-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-数组-或--拼接字符串
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用字符串拼接的方式生成html需要根据语境进行合理的转义
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-复杂的数据到视图字符串的转换过程选用一种模板引擎
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#36-对象
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-使用对象字面量--创建新-object
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对象创建时如果一个对象的所有-属性-均可以不添加引号建议所有-属性-不添加引号
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对象创建时如果任何一个-属性-需要添加引号则所有-属性-建议添加-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-不允许修改和扩展任何原生对象和宿主对象的原型
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-属性访问时尽量使用-
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-for-in-遍历对象时-使用-hasownproperty-过滤掉原型中的属性
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#37-数组
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-使用数组字面量--创建新数组除非想要创建的是指定长度的数组
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-遍历数组不使用-for-in
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-不因为性能的原因自己实现数组排序功能尽量使用数组的-sort-方法
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-清空数组使用-length--0
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#38-函数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#381-函数长度
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-一个函数的长度控制在-50-行以内
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#382-参数设计
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-一个函数的参数控制在-6-个以内
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-通过-options-参数传递非数据输入型参数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#383-闭包
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-在适当的时候将闭包内大对象置为-null
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-iife-避免-lift-效应
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#384-空函数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-空函数不使用-new-function-的形式
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于性能有高要求的场合建议存在一个空函数的常量供多处使用共享
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#39-面向对象
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-类的继承方案实现时需要修正-constructor
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-声明类时保证-constructor-的正确性
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-属性在构造函数中声明方法在原型中声明
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-自定义事件的-事件名-必须全小写
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-自定义事件只能有一个-event-参数如果事件需要传递较多信息应仔细设计事件对象
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-设计自定义事件时应考虑禁止默认行为
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#310-动态特性
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3101-eval
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-避免使用直接-eval-函数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-尽量避免使用-eval-函数
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3102-动态执行代码
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-new-function-执行动态代码
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3103-with
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-尽量不要使用-with
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3104-delete
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-减少-delete-的使用
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-处理-delete-可能产生的异常
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#3105-对象属性
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-避免修改外部传入的对象
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-具备强类型的设计
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#4-浏览器环境
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#41-模块化
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#411-amd
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-使用-amd-作为模块定义
requirejshttp://requirejs.org/
eslhttps://github.com/ecomfe/esl
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-模块-id-必须符合标准
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#412-define
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-定义模块时不要指明-id-和-dependencies
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-return-来返回模块定义
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#413-require
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-全局运行环境中require-必须以-async-require-形式调用
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-模块定义中只允许使用-local-require不允许使用-global-require
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-package-在实现时内部模块的-require-必须使用-relative-id
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-不会被调用的依赖模块在-factory-开始处统一-require
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#42-dom
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#421-元素获取
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于单个元素尽可能使用-documentgetelementbyid-获取避免使用documentall
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-对于多个元素的集合尽可能使用-contextgetelementsbytagname-获取其中-context-可以为-document-或其他元素指定-tagname-参数为--可以获得所有子元素
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-遍历元素集合时尽量缓存集合长度如需多次操作同一集合则应将集合转为数组
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-获取元素的直接子元素时使用-children避免使用childnodes除非预期是需要包含文本注释和属性类型的节点
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#422-样式获取
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-获取元素实际样式信息时应使用-getcomputedstyle-或-currentstyle
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#423-样式设置
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-尽可能通过为元素添加预定义的-classname-来改变元素样式避免直接操作-style-设置
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#强制-通过-style-对象设置元素样式时对于带单位非-0-值的属性不允许省略单位
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#424-dom-操作
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-操作-dom-时尽量减少页面-reflow
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-尽量减少-dom-操作
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#425-dom-事件
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-优先使用-addeventlistener--attachevent-绑定事件避免直接在-html-属性中或-dom-的-expando-属性绑定事件处理
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-使用-addeventlistener-时第三个参数使用-false
https://github.com/shjborage/CodingStyle/blob/master/JavaScript.md#建议-在没有事件自动管理的框架支持下应持有监听器函数的引用在适当时候元素释放页面卸载等移除添加的监听器
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.