Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
CoderViking
notes
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
notes
/
JavaSript
/
javascript-全局函数.js
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
69 lines (52 loc) · 1.43 KB
master
Breadcrumbs
notes
/
JavaSript
/
javascript-全局函数.js
Copy path
Top
File metadata and controls
Code
Blame
69 lines (52 loc) · 1.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
--
--
--
--
--
--
--
--
--
--
Index
|
--
--
--
--
--
--
--
--
--
--
typeof
(
test
)
;
*
查看指定变量的数据类型
encodeURI
(
)
*
把字符串编码为
URI。
*
可以把中文
,
空格
,
进行URI编码
*
该方法不会对
ASCII
字母和数字进行编码,也不会对这些
ASCII
标点符号进行编码:
-
_
.
!
~
*
' ( ) 。
encodeURIComponent
(
)
*
把字符串编码为
URI
组件。
*
不仅仅是中文
,
空格
,
把符号也给转码了
:
//
?
decodeURI
(
)
*
解码某个编码的
URI。
decodeURIComponent
(
)
*
解码一个编码的
URI
组件。
eval
(
)
*
计算
JavaScript
字符串,并把它作为脚本代码来执行。
*
把字符串当作JAVA脚本执行
eval
(
"var user = {name:'KevinBlandy'}"
)
;
println
(
user
.
name
)
;
*
就是一个JS解析器
,
很叼
var
str
=
"{name:'KevinBlandy',age:18}"
;
var
obj
=
eval
(
"("
+
str
+
")"
)
;
isFinite
(
)
*
当参数不是
NaN
,
Infinity
,
-
Infinity
的时候返回
true
isNaN
(
)
*
检查某个值是否是数字。
*
如果你是数字
,
返回
false
*
如果你不是数字
,
返回
true
*
数字类型的字符串
,
也被认为是数字
Number
(
)
*
把对象的值转换为数字
,
如果参数不标准
,
就会导致转换失败
*
如果转换失败
,
返回
NaN
parseInt
(
)
*
解析一个字符串并返回一个整数。
*
任何0x
/
0
x都被会解析为16进制
*
对于小数
,
会直接去掉小数
*
对于表达不规范的数值字符串
,
如果第一个字符串是数值
,
那么就会进行解析
,
直到遇到非数值字符串
,
或者字符串末尾
.
*
如果转换失败
,
返回
NaN
parseFloat
(
)
*
解析一个字符串并返回一个浮点数。
*
同上
String
(
)
*
把对象的值转换为字符串。
escape
(
)
*
对字符串进行编码。
unescape
(
)
*
对由
escape
(
)
编码的字符串进行解码。
You can’t perform that action at this time.