ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
JS Basic:?
By Value V.S ?
By Reference
Leeboy @ goodideas-studio?
2017.03.10
Primitive type(1/6)
Booleans
Number
String
undefined
null
compare by value ?ÖµÏà±È
Ö»ÓÐÔÚ¾ßÓÐÏàͬµÄÖµ£¬ƒÉÕß²ÅÏàµÈ
Pass by value (e.g 1)
Copy by value (e.g 2)
Primitive type(2/6)
e.g.1 Pass by value
Primitive type(3/6)
e.g.2 Copy by value
Primitive type(4/6)
String
- ²»¿É׃µÄ£¨immutable£©(e.g 3)
- éL¶ÈÏàµÈ£¬Ë÷ÒýλÖÃ×ÖÔªÏàµÈ ?Quiz
- Are strings compared by value or by reference?
Primitive type(5/6)
immutable
Quiz1
Q:Œ‘?‚€±ÈÝ^ƒÉ×Ö´®µÄº¯”µ
Primitive type(6/6)
summary
Objective type(1/4)
Object
Function
Array
Set
mutable
compare (e.g1)(e.g 2)
‚€„eÎï¼þÓÀ²»ÏàµÈ
‚€„eê‡ÁÐÓÀ²»ÏàµÈ
clone ÈçºÎÑ}Ñu (e.g3)(?quiz)
Objective type(2/4)
e.g.1 Compare by reference
Two references to distinct values are not equal,
even if the two values consist of the same bytes.
Objective type(3/4)
e.g.2 Compare by reference
Two references are compared
to see if they refer to the same value.
Objective type(4/4)
e.g.3 Object Clone
Quiz2 Array Clone
ÕˆÑ}Ñu const DC = ['Batman', 'Jocker', 'Flash', 'SuperGirl']
DC_copy.push(¡®Arrow') //ÔÚÑ}ÑuµÄê‡ÁÐ push ?‚€ÐÂÖµ
console.log(DC,DC_copy) // Ó¡ÔÚ console

More Related Content

Recently uploaded (20)

Odoo POS Development Company .pdf
Odoo POS Development Company        .pdfOdoo POS Development Company        .pdf
Odoo POS Development Company .pdf
dela33martin33
?
The-Power-of-Digital-Marketing-Fueling-Business-Growth.pdf
The-Power-of-Digital-Marketing-Fueling-Business-Growth.pdfThe-Power-of-Digital-Marketing-Fueling-Business-Growth.pdf
The-Power-of-Digital-Marketing-Fueling-Business-Growth.pdf
makelinkak002
?
Hire Odoo Consultant .pdf
Hire Odoo Consultant                .pdfHire Odoo Consultant                .pdf
Hire Odoo Consultant .pdf
dela33martin33
?
Let¡¯s make Cycling Smarter and Safer.pptx
Let¡¯s make Cycling Smarter and Safer.pptxLet¡¯s make Cycling Smarter and Safer.pptx
Let¡¯s make Cycling Smarter and Safer.pptx
hapax77239
?
Dell EMC Club SE Unity estrategia y negocio
Dell EMC Club SE Unity estrategia y negocioDell EMC Club SE Unity estrategia y negocio
Dell EMC Club SE Unity estrategia y negocio
Fernando564134
?
IETF 122: draft-ietf-regext-rdap-rir-search-16
IETF 122: draft-ietf-regext-rdap-rir-search-16IETF 122: draft-ietf-regext-rdap-rir-search-16
IETF 122: draft-ietf-regext-rdap-rir-search-16
APNIC
?
Expert Odoo support services (1).pdf
Expert Odoo support services     (1).pdfExpert Odoo support services     (1).pdf
Expert Odoo support services (1).pdf
dela33martin33
?
BGP Best Practices, presented by Imtiaz Sajid
BGP Best Practices, presented by Imtiaz SajidBGP Best Practices, presented by Imtiaz Sajid
BGP Best Practices, presented by Imtiaz Sajid
APNIC
?
Mobile App Security Essential Tips to Protect Your App in 2025.pdf
Mobile App Security Essential Tips to Protect Your App in 2025.pdfMobile App Security Essential Tips to Protect Your App in 2025.pdf
Mobile App Security Essential Tips to Protect Your App in 2025.pdf
WebConnect Pvt Ltd
?
DB.pptx data base HNS level III 2017 yearx
DB.pptx data base HNS level III 2017 yearxDB.pptx data base HNS level III 2017 yearx
DB.pptx data base HNS level III 2017 yearx
kebimesay23
?
Microsoft Azure: Empowering the Future of Cloud Technology
Microsoft Azure: Empowering the Future of Cloud TechnologyMicrosoft Azure: Empowering the Future of Cloud Technology
Microsoft Azure: Empowering the Future of Cloud Technology
cyberpoint678
?
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh ThakurComplete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Hackopedia Utkarsh Thakur
?
Odoo Customization Services .pdf
Odoo Customization Services         .pdfOdoo Customization Services         .pdf
Odoo Customization Services .pdf
dela33martin33
?
ºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdf
ºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdfºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdf
ºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdf
Steven McGee
?
Scope of Work by ºÝºÝߣsgo.pptx by school
Scope of Work by ºÝºÝߣsgo.pptx by schoolScope of Work by ºÝºÝߣsgo.pptx by school
Scope of Work by ºÝºÝߣsgo.pptx by school
larasgm2002
?
ESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdf
ESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdfESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdf
ESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdf
HELLEN CRISTINA
?
Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...
Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...
Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...
treyka
?
Chapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdf
Chapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdfChapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdf
Chapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdf
hamsalubekana
?
01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf
01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf
01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf
Fernando564134
?
? SITUS GACOR TERPERCAYA - KAJIAN4D! ?
? SITUS GACOR TERPERCAYA - KAJIAN4D! ?? SITUS GACOR TERPERCAYA - KAJIAN4D! ?
? SITUS GACOR TERPERCAYA - KAJIAN4D! ?
KAJIAN4D
?
Odoo POS Development Company .pdf
Odoo POS Development Company        .pdfOdoo POS Development Company        .pdf
Odoo POS Development Company .pdf
dela33martin33
?
The-Power-of-Digital-Marketing-Fueling-Business-Growth.pdf
The-Power-of-Digital-Marketing-Fueling-Business-Growth.pdfThe-Power-of-Digital-Marketing-Fueling-Business-Growth.pdf
The-Power-of-Digital-Marketing-Fueling-Business-Growth.pdf
makelinkak002
?
Hire Odoo Consultant .pdf
Hire Odoo Consultant                .pdfHire Odoo Consultant                .pdf
Hire Odoo Consultant .pdf
dela33martin33
?
Let¡¯s make Cycling Smarter and Safer.pptx
Let¡¯s make Cycling Smarter and Safer.pptxLet¡¯s make Cycling Smarter and Safer.pptx
Let¡¯s make Cycling Smarter and Safer.pptx
hapax77239
?
Dell EMC Club SE Unity estrategia y negocio
Dell EMC Club SE Unity estrategia y negocioDell EMC Club SE Unity estrategia y negocio
Dell EMC Club SE Unity estrategia y negocio
Fernando564134
?
IETF 122: draft-ietf-regext-rdap-rir-search-16
IETF 122: draft-ietf-regext-rdap-rir-search-16IETF 122: draft-ietf-regext-rdap-rir-search-16
IETF 122: draft-ietf-regext-rdap-rir-search-16
APNIC
?
Expert Odoo support services (1).pdf
Expert Odoo support services     (1).pdfExpert Odoo support services     (1).pdf
Expert Odoo support services (1).pdf
dela33martin33
?
BGP Best Practices, presented by Imtiaz Sajid
BGP Best Practices, presented by Imtiaz SajidBGP Best Practices, presented by Imtiaz Sajid
BGP Best Practices, presented by Imtiaz Sajid
APNIC
?
Mobile App Security Essential Tips to Protect Your App in 2025.pdf
Mobile App Security Essential Tips to Protect Your App in 2025.pdfMobile App Security Essential Tips to Protect Your App in 2025.pdf
Mobile App Security Essential Tips to Protect Your App in 2025.pdf
WebConnect Pvt Ltd
?
DB.pptx data base HNS level III 2017 yearx
DB.pptx data base HNS level III 2017 yearxDB.pptx data base HNS level III 2017 yearx
DB.pptx data base HNS level III 2017 yearx
kebimesay23
?
Microsoft Azure: Empowering the Future of Cloud Technology
Microsoft Azure: Empowering the Future of Cloud TechnologyMicrosoft Azure: Empowering the Future of Cloud Technology
Microsoft Azure: Empowering the Future of Cloud Technology
cyberpoint678
?
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh ThakurComplete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Complete Nmap Scanning Commands CheatSheet by Hackopedia Utkarsh Thakur
Hackopedia Utkarsh Thakur
?
Odoo Customization Services .pdf
Odoo Customization Services         .pdfOdoo Customization Services         .pdf
Odoo Customization Services .pdf
dela33martin33
?
ºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdf
ºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdfºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdf
ºÝºÝߣs: Eco Economic Epochs World Game's Great Redesign .pdf
Steven McGee
?
Scope of Work by ºÝºÝߣsgo.pptx by school
Scope of Work by ºÝºÝߣsgo.pptx by schoolScope of Work by ºÝºÝߣsgo.pptx by school
Scope of Work by ºÝºÝߣsgo.pptx by school
larasgm2002
?
ESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdf
ESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdfESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdf
ESTUDO DO ARTIGO 22 AO 39 DO C?DIGO C?VIL.pdf
HELLEN CRISTINA
?
Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...
Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...
Epochalypse 2038 - Remediating the 32-bit Timestamp Risk at Global Scale (Pub...
treyka
?
Chapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdf
Chapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdfChapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdf
Chapter 1 Handoutfffffffffffffffffffffffffffffffffffff.pdf
hamsalubekana
?
01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf
01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf
01 Dell EMC Heroes Novedades de DPS_Estrategia.pdf
Fernando564134
?
? SITUS GACOR TERPERCAYA - KAJIAN4D! ?
? SITUS GACOR TERPERCAYA - KAJIAN4D! ?? SITUS GACOR TERPERCAYA - KAJIAN4D! ?
? SITUS GACOR TERPERCAYA - KAJIAN4D! ?
KAJIAN4D
?

Featured (20)

Artificial Intelligence, Data and Competition ¨C SCHREPEL ¨C June 2024 OECD dis...
Artificial Intelligence, Data and Competition ¨C SCHREPEL ¨C June 2024 OECD dis...Artificial Intelligence, Data and Competition ¨C SCHREPEL ¨C June 2024 OECD dis...
Artificial Intelligence, Data and Competition ¨C SCHREPEL ¨C June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
?
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
?
2024 State of Marketing Report ¨C by Hubspot
2024 State of Marketing Report ¨C by Hubspot2024 State of Marketing Report ¨C by Hubspot
2024 State of Marketing Report ¨C by Hubspot
Marius Sescu
?
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
?
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
?
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
?
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
?
2024 State of Marketing Report ¨C by Hubspot
2024 State of Marketing Report ¨C by Hubspot2024 State of Marketing Report ¨C by Hubspot
2024 State of Marketing Report ¨C by Hubspot
Marius Sescu
?
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
?
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
?
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
?
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
?
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
?
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
?
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
?
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
?
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
?
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
?
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
?
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
?
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
?

JS Basic: By value versus By reference