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
Developer articles
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 }}
cshuig
javascript_study
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
javascript_study
/
1.1_函数的定义.html
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
41 lines (34 loc) · 1.34 KB
master
Breadcrumbs
javascript_study
/
1.1_函数的定义.html
Copy path
Top
File metadata and controls
Code
Blame
41 lines (34 loc) · 1.34 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
<!DOCTYPE html PULBIC "-//W3C//DTD HTML 4.01/EN"
"http/www.w3.org/TR/html4/strict.dtd"
>
<
html
xmlns
="
http://www.w3.org/1999/xhmtl
"
lang
="
en
"
>
<
head
>
<
meta
http
=
equiv
="Content-Type" content="text/html; charset=utr-8"
/>
<
titl
>
01_函数的定义
</
title
>
<
meta
name
="
author
"
content
="
cshuig
"
/>
<
script
type
="
text/javascript
"
>
//第一种函数的定义
function
fn1
(
)
{
alert
(
"fn1"
)
;
}
//函数其实就是一个非常特殊的对象,是一个Function类的实例,其实在内存中存储的操作是通过一个键值对的存储
alert
(
typeof
fn1
)
;
//由于函数是一个对象,所以可以通过如下的方式定义
//以下是通过函数的拷贝来完成赋值,两个引用并没有执行同一个对象。
var
fn2
=
fn1
fn2
(
)
;
fn1
=
function
(
)
{
alert
(
"fnn1"
)
;
}
//函数虽然是一个对象,但是却和对象有一些区别,对象是通过引用的指向完成对象的赋值,而函数却是通过对象的拷贝来完成的,所以fn1虽然变了,但是不会影响fn2
fn1
(
)
;
fn2
(
)
;
//对于对象而言,是通过引用的指向来完成赋值的,这两个对象指向同一个地址,此时修改obj1或者obj2都会完成修改
var
obj1
=
new
Object
(
)
;
var
obj2
=
obj1
;
obj2
.
name
=
"cshuig"
;
alert
(
obj1
.
name
)
;
</
script
>
</
head
>
<
body
>
</
body
>
</
html
>
You can’t perform that action at this time.