Suche senden
Hochladen
簡單介紹JavaScript變數範圍
•
Als PPTX, PDF herunterladen
•
3 gefällt mir
•
1,381 views
林儀泰 Tommy Lin
Folgen
簡單介紹JavaScript變數範圍
Weniger lesen
Mehr lesen
Präsentationen & Vorträge
Diashow-Anzeige
Melden
Teilen
Diashow-Anzeige
Melden
Teilen
1 von 24
Jetzt herunterladen
Empfohlen
5, workflow function activity
5, workflow function activity
ted-xu
單元測試:Mocha、Chai 和 Sinon
單元測試:Mocha、Chai 和 Sinon
Hsin-Hao Tang
检查实现类
检查实现类
Wu Liang
改善程序设计技术的50个有效做法
改善程序设计技术的50个有效做法
crasysatan
PHPUnit + Xdebug 单元测试技术
PHPUnit + Xdebug 单元测试技术
hoopchina
揭开Javascript的面纱
揭开Javascript的面纱
qiang
簡單介紹JavaScript參數傳遞
簡單介紹JavaScript參數傳遞
林儀泰 Tommy Lin
簡單介紹JavaScript資料型態
簡單介紹JavaScript資料型態
林儀泰 Tommy Lin
Empfohlen
5, workflow function activity
5, workflow function activity
ted-xu
單元測試:Mocha、Chai 和 Sinon
單元測試:Mocha、Chai 和 Sinon
Hsin-Hao Tang
检查实现类
检查实现类
Wu Liang
改善程序设计技术的50个有效做法
改善程序设计技术的50个有效做法
crasysatan
PHPUnit + Xdebug 单元测试技术
PHPUnit + Xdebug 单元测试技术
hoopchina
揭开Javascript的面纱
揭开Javascript的面纱
qiang
簡單介紹JavaScript參數傳遞
簡單介紹JavaScript參數傳遞
林儀泰 Tommy Lin
簡單介紹JavaScript資料型態
簡單介紹JavaScript資料型態
林儀泰 Tommy Lin
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything 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 Engineerings
Pixeldarts
How 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.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO 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)
contently
How 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 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 2024
Search Engine Journal
5 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
Clark Boyd
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 Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Weitere ähnliche Inhalte
Empfohlen
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything 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 Engineerings
Pixeldarts
How 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.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO 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)
contently
How 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 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 2024
Search Engine Journal
5 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
Clark Boyd
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 Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Empfohlen
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
簡單介紹JavaScript變數範圍
1.
Tommy Lin 林儀泰 FB/Email:tooto1985@gmail.com
2.
限制被宣告的變數有效存取範圍 ◦ 函式內可以存取函式外的變數
3.
存取函式外層變數 var a=100; function run()
{ var b=100; console.log(a); } run();
4.
存取函式外層變數 var a=100; function run()
{ var b=100; console.log(a); //100 } run();
5.
限制被宣告的變數有效存取範圍 ◦ 函式內可以存取函式外的變數 ◦
函式外不可存取函式內的變數
6.
存取函式內層變數 var a=100; function run()
{ var b=100; } run(); console.log(b);
7.
存取函式內層變數 var a=100; function run()
{ var b=100; } run(); console.log(b); //undefined
8.
限制被宣告的變數有效存取範圍 ◦ 函式內可以存取函式外的變數 ◦
函式外不可存取函式內的變數 以函式來界定存取範圍(ES5)
9.
函式界定範圍 var a=0; function run()
{ if(true) { var a=1; } console.log(a); } run(); console.log(a);
10.
函式界定範圍 var a=0; function run()
{ if(true) { var a=1; } console.log(a); } run(); console.log(a); //0
11.
函式界定範圍 var a=0; function run()
{ if(true) { var a=1; } console.log(a); //1 } run(); console.log(a); //0
12.
限制被宣告的變數有效存取範圍 ◦ 函式內可以存取函式外的變數 ◦
函式外不可存取函式內的變數 以函式來界定存取範圍(ES5) ◦ ES6支援以區塊界定範圍的宣告let
13.
區塊界定範圍(ES6) function run() { var
a = 0; if(true) { let a=1; console.log(a); } console.log(a); } run();
14.
區塊界定範圍(ES6) function run() { var
a = 0; if(true) { let a=1; console.log(a); //1 } console.log(a); } run();
15.
區塊界定範圍(ES6) function run() { var
a = 0; if(true) { let a=1; console.log(a); //1 } console.log(a); //0 } run();
16.
限制被宣告的變數有效存取範圍 ◦ 函式內可以存取函式外的變數 ◦
函式外不可存取函式內的變數 以函式來界定存取範圍(ES5) ◦ ES6支援以區塊界定範圍的宣告let 必須是套崁函式並非引用函式
17.
套崁函式 var a =
100; function run() { var b = 200; function todo() { console.log(b); } todo(); console.log(a); } run();
18.
套崁函式 var a =
100; function run() { var b = 200; function todo() { console.log(b); //200 } todo(); console.log(a); } run();
19.
套崁函式 var a =
100; function run() { var b = 200; function todo() { console.log(b); //200 } todo(); console.log(a); //100 } run();
20.
引用函式 var a =
100; function todo() { console.log(b); } function run() { var b = 200; todo(); console.log(a); } run();
21.
引用函式 var a =
100; function todo() { console.log(b); } function run() { var b = 200; todo(); console.log(a); //100 } run();
22.
引用函式 var a =
100; function todo() { console.log(b); //undefined } function run() { var b = 200; todo(); console.log(a); //100 } run();
23.
內層可以存取外層 外層不可以存取內層
函式界定存取範圍 區塊界定存取範圍需使用let宣告(ES6) 必須是套崁函式才可存取
24.
https://developer.mozilla.org/en- US/docs/Web/JavaScript/Reference/Statements/var https://developer.mozilla.org/en- US/docs/Web/JavaScript/Reference/Statements/let
Jetzt herunterladen