Soumettre la recherche
Mettre en ligne
JavaScript Beginner Tutorial | WeiYuan
•
1 j'aime
•
306 vues
Wei-Yuan Chang
Suivre
JavaScript Beginner Tutorial | WeiYuan
Lire moins
Lire la suite
Technologie
Signaler
Partager
Signaler
Partager
1 sur 39
Recommandé
資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan
Wei-Yuan Chang
(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy
Alonso Torres
groovy rules
groovy rules
Paul King
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Guillaume Laforge
18(ish) Things You'll Love About Oracle Database 18c
18(ish) Things You'll Love About Oracle Database 18c
Chris Saxon
Refresher
Refresher
Max Friel
JavaScript Bootcamp
JavaScript Bootcamp
Jan Maximilian Winther Kristiansen
A Re-Introduction to JavaScript
A Re-Introduction to JavaScript
Simon Willison
Recommandé
資料視覺化 - D3 的第一堂課 | WeiYuan
資料視覺化 - D3 的第一堂課 | WeiYuan
Wei-Yuan Chang
(Greach 2015) Dsl'ing your Groovy
(Greach 2015) Dsl'ing your Groovy
Alonso Torres
groovy rules
groovy rules
Paul King
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Groovy in the Enterprise - Case Studies - TSSJS Prague 2008 - Guillaume Laforge
Guillaume Laforge
18(ish) Things You'll Love About Oracle Database 18c
18(ish) Things You'll Love About Oracle Database 18c
Chris Saxon
Refresher
Refresher
Max Friel
JavaScript Bootcamp
JavaScript Bootcamp
Jan Maximilian Winther Kristiansen
A Re-Introduction to JavaScript
A Re-Introduction to JavaScript
Simon Willison
Javascript The Good Parts
Javascript The Good Parts
Federico Galassi
Javascript basics
Javascript basics
Solv AS
LinkedIn TBC JavaScript 100: Intro
LinkedIn TBC JavaScript 100: Intro
Adam Crabtree
Unit - 4 all script are here Javascript.pptx
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
Javascript status 2016
Javascript status 2016
Arshavski Alexander
csc ppt 15.pptx
csc ppt 15.pptx
RavneetSingh343801
Goodparts
Goodparts
damonjablons
javascript teach
javascript teach
guest3732fa
JSBootcamp_White
JSBootcamp_White
guest3732fa
JSARToolKit / LiveChromaKey / LivePointers - Next gen of AR
JSARToolKit / LiveChromaKey / LivePointers - Next gen of AR
Yusuke Kawasaki
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
Ajax Experience 2009
JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
JavaScript Looping Statements
JavaScript Looping Statements
Janssen Harvey Insigne
JavaScript Proven Practises
JavaScript Proven Practises
Robert MacLean
Headless Js Testing
Headless Js Testing
Brian Moschel
JavaScript 2016 for C# Developers
JavaScript 2016 for C# Developers
Rick Beerendonk
JavaScript from Scratch: Getting Your Feet Wet
JavaScript from Scratch: Getting Your Feet Wet
Michael Girouard
"JS: the right way" by Mykyta Semenistyi
"JS: the right way" by Mykyta Semenistyi
Binary Studio
Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)
Benjamin Bock
Maintainable JavaScript
Maintainable JavaScript
Nicholas Zakas
Python Fundamentals - Basic
Python Fundamentals - Basic
Wei-Yuan Chang
Data Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuan
Wei-Yuan Chang
Contenu connexe
Similaire à JavaScript Beginner Tutorial | WeiYuan
Javascript The Good Parts
Javascript The Good Parts
Federico Galassi
Javascript basics
Javascript basics
Solv AS
LinkedIn TBC JavaScript 100: Intro
LinkedIn TBC JavaScript 100: Intro
Adam Crabtree
Unit - 4 all script are here Javascript.pptx
Unit - 4 all script are here Javascript.pptx
kushwahanitesh592
Javascript status 2016
Javascript status 2016
Arshavski Alexander
csc ppt 15.pptx
csc ppt 15.pptx
RavneetSingh343801
Goodparts
Goodparts
damonjablons
javascript teach
javascript teach
guest3732fa
JSBootcamp_White
JSBootcamp_White
guest3732fa
JSARToolKit / LiveChromaKey / LivePointers - Next gen of AR
JSARToolKit / LiveChromaKey / LivePointers - Next gen of AR
Yusuke Kawasaki
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
Ajax Experience 2009
JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
WebStackAcademy
JavaScript Looping Statements
JavaScript Looping Statements
Janssen Harvey Insigne
JavaScript Proven Practises
JavaScript Proven Practises
Robert MacLean
Headless Js Testing
Headless Js Testing
Brian Moschel
JavaScript 2016 for C# Developers
JavaScript 2016 for C# Developers
Rick Beerendonk
JavaScript from Scratch: Getting Your Feet Wet
JavaScript from Scratch: Getting Your Feet Wet
Michael Girouard
"JS: the right way" by Mykyta Semenistyi
"JS: the right way" by Mykyta Semenistyi
Binary Studio
Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)
Benjamin Bock
Maintainable JavaScript
Maintainable JavaScript
Nicholas Zakas
Similaire à JavaScript Beginner Tutorial | WeiYuan
(20)
Javascript The Good Parts
Javascript The Good Parts
Javascript basics
Javascript basics
LinkedIn TBC JavaScript 100: Intro
LinkedIn TBC JavaScript 100: Intro
Unit - 4 all script are here Javascript.pptx
Unit - 4 all script are here Javascript.pptx
Javascript status 2016
Javascript status 2016
csc ppt 15.pptx
csc ppt 15.pptx
Goodparts
Goodparts
javascript teach
javascript teach
JSBootcamp_White
JSBootcamp_White
JSARToolKit / LiveChromaKey / LivePointers - Next gen of AR
JSARToolKit / LiveChromaKey / LivePointers - Next gen of AR
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
JavaScript Looping Statements
JavaScript Looping Statements
JavaScript Proven Practises
JavaScript Proven Practises
Headless Js Testing
Headless Js Testing
JavaScript 2016 for C# Developers
JavaScript 2016 for C# Developers
JavaScript from Scratch: Getting Your Feet Wet
JavaScript from Scratch: Getting Your Feet Wet
"JS: the right way" by Mykyta Semenistyi
"JS: the right way" by Mykyta Semenistyi
Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)
Maintainable JavaScript
Maintainable JavaScript
Plus de Wei-Yuan Chang
Python Fundamentals - Basic
Python Fundamentals - Basic
Wei-Yuan Chang
Data Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuan
Wei-Yuan Chang
Data Crawler using Python (I) | WeiYuan
Data Crawler using Python (I) | WeiYuan
Wei-Yuan Chang
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
Wei-Yuan Chang
Scientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuan
Wei-Yuan Chang
Basic Web Development | WeiYuan
Basic Web Development | WeiYuan
Wei-Yuan Chang
Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
Wei-Yuan Chang
Introduce to PredictionIO
Introduce to PredictionIO
Wei-Yuan Chang
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Wei-Yuan Chang
Forecasting Fine Grained Air Quality Based on Big Data
Forecasting Fine Grained Air Quality Based on Big Data
Wei-Yuan Chang
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
Wei-Yuan Chang
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
Wei-Yuan Chang
Effective Event Identification in Social Media
Effective Event Identification in Social Media
Wei-Yuan Chang
Eears (earthquake alert and report system) a real time decision support syst...
Eears (earthquake alert and report system) a real time decision support syst...
Wei-Yuan Chang
Fine Grained Location Extraction from Tweets with Temporal Awareness
Fine Grained Location Extraction from Tweets with Temporal Awareness
Wei-Yuan Chang
Practical Lessons from Predicting Clicks on Ads at Facebook
Practical Lessons from Predicting Clicks on Ads at Facebook
Wei-Yuan Chang
How many folders do you really need ? Classifying email into a handful of cat...
How many folders do you really need ? Classifying email into a handful of cat...
Wei-Yuan Chang
Extending faceted search to the general web
Extending faceted search to the general web
Wei-Yuan Chang
Discovering human places of interest from multimodal mobile phone data
Discovering human places of interest from multimodal mobile phone data
Wei-Yuan Chang
Online Debate Summarization using Topic Directed Sentiment Analysis
Online Debate Summarization using Topic Directed Sentiment Analysis
Wei-Yuan Chang
Plus de Wei-Yuan Chang
(20)
Python Fundamentals - Basic
Python Fundamentals - Basic
Data Analysis with Python - Pandas | WeiYuan
Data Analysis with Python - Pandas | WeiYuan
Data Crawler using Python (I) | WeiYuan
Data Crawler using Python (I) | WeiYuan
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
Scientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuan
Basic Web Development | WeiYuan
Basic Web Development | WeiYuan
Python fundamentals - basic | WeiYuan
Python fundamentals - basic | WeiYuan
Introduce to PredictionIO
Introduce to PredictionIO
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Analysis and Classification of Respiratory Health Risks with Respect to Air P...
Forecasting Fine Grained Air Quality Based on Big Data
Forecasting Fine Grained Air Quality Based on Big Data
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Coverage of Science in the Media a Big Data Study on the Impact of th...
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
On the Ground Validation of Online Diagnosis with Twitter and Medical Records
Effective Event Identification in Social Media
Effective Event Identification in Social Media
Eears (earthquake alert and report system) a real time decision support syst...
Eears (earthquake alert and report system) a real time decision support syst...
Fine Grained Location Extraction from Tweets with Temporal Awareness
Fine Grained Location Extraction from Tweets with Temporal Awareness
Practical Lessons from Predicting Clicks on Ads at Facebook
Practical Lessons from Predicting Clicks on Ads at Facebook
How many folders do you really need ? Classifying email into a handful of cat...
How many folders do you really need ? Classifying email into a handful of cat...
Extending faceted search to the general web
Extending faceted search to the general web
Discovering human places of interest from multimodal mobile phone data
Discovering human places of interest from multimodal mobile phone data
Online Debate Summarization using Topic Directed Sentiment Analysis
Online Debate Summarization using Topic Directed Sentiment Analysis
Dernier
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
sammart93
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
apidays
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
hans926745
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Khem
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Andrey Devyatkin
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
V3cube
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
hans926745
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Dernier
(20)
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
JavaScript Beginner Tutorial | WeiYuan
1.
JavaScript Beginner Tutorial 2017/06/27
(Wed.) WeiYuan
2.
site: v123582.github.io line: weiwei63 §
全端⼯程師 + 資料科學家 略懂⼀點網站前後端開發技術,學過資料探勘與機器 學習的⽪⽑。平時熱愛參與技術社群聚會及貢獻開源 程式的樂趣。
3.
Outline § The past
and now of JavaScript § A HTML with CSS and JavaScript § Common Type § Flow Control § Function § Advanced JavaScript 3
4.
Outline § The past
and now of JavaScript § A HTML with CSS and JavaScript § Common Type § Flow Control § Function § Advanced JavaScript 4
5.
The past and
now of JavaScript § 1995 網景 Netscape 公司 Brendan Eich 設計 § ECMAScript 標準 == ECMA - 262 § Javascript 屬於 ECMAScript 標準的一種實作 § ES5 → ES6 (ES2015) → ES7 (ES2016) • 預計每年會更新一個新版本 5
6.
Outline § The past
and now of JavaScript § A HTML with CSS and JavaScript § Common Type § Flow Control § Function § Advanced JavaScript 6
7.
A HTML with
CSS and JavaScript § HTML => 內容,佈局 § CSS => 樣式,外觀 § JavaScript => ⾏為,互動 7
8.
A HTML with
CSS and JavaScript 8
9.
A HTML with
CSS and JavaScript link 9
10.
JavaScript § Statement =
Variable + Operator § weakly typed, dynamically typed § case sensitive 10 1 2 3 4 5 6 7 8 9 /* declare, then set value */ var str; str = "hello"; // declare and set value var length = 5; console.log(str); alert(length);
11.
Outline § The past
and now of JavaScript § A HTML with CSS and JavaScript § Common Type § Flow Control § Function § Advanced JavaScript 11
12.
Common Type § Number §
String § Boolean, Undefined, Null § Array [ ] § Object { : } 12
13.
Common Type § Number •
Arithmetic: + - * / % • Logical: &&, ||, ! § String § Boolean, Undefined, Null § Array [ ] § Object { : } 13 1 2 3 4 5 var length = 16; // Number 通过数字字面量赋值 typeof 3.14 // 返回 number
14.
Common Type § Number §
String § Boolean, Undefined, Null § Array [ ] § Object { : } 14 1 2 3 4 5 var lastName = "Johnson"; // Number 通过数字字面量赋值 typeof "John” // 返回 number
15.
Common Type § Number §
String § Boolean, Undefined, Null § Array [ ] § Object { : } 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 true false typeof undefined // undefined typeof null // object null === undefined // false null == undefined // true
16.
Common Type § Number §
String § Boolean, Undefined, Null § Array [ ] § Object { : } 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 var arr = [1, 2, 3]; arr.length // 3 arr.push(4) // 從右 +1 arr.pop() // 從右 -1 arr.shift() // 從左 -1 arr.unshift(0) // 從左 +1 arr.concat([111, 222]) arr.splice(index, number, item) // 刪除從 index 開始 number 個數,插入 item arr.join(',') == "1,2,3".split(',')
17.
Common Type § Number §
String § Boolean, Undefined, Null § Array [ ] § Object { : } 17 1 2 3 4 5 6 7 8 9 var cars = ["Saab", "Volvo", "BMW"]; // Array 通过数组字面量赋值 typeof [1,2,3,4] // 返回 object cars[0] // Saab
18.
Common Type § Number §
String § Boolean, Undefined, Null § Array [ ] § Object { : } 18 1 2 3 4 5 6 7 8 9 10 11 12 13 14 var person = { // property id : 5566, firstName: "John", lastName : "Doe", // method fullName : function() { return this.firstName + " " + this.lastName; }}; console.log(person.firstName); console.log(person["lastName"]); console.log(person.fullName());
19.
19Ref: https://stackoverflow.com/questions/7615214/in-javascript-why-is-0-equal-to-false-but-when-tested-by-if-it-is-not-fals
20.
20Ref: https://stackoverflow.com/questions/7615214/in-javascript-why-is-0-equal-to-false-but-when-tested-by-if-it-is-not-fals
21.
Try it! 21 § #練習:有⼀個陣列,其中包括
10 個元素,例如這個列表是 [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]。 1. 要求將列表中的每個元素⼀次向前移動⼀個位置,第⼀個元素 到列表的最後,然後輸出這個列表。最終樣式是 [2, 3, 4, 5, 6, 7, 8, 9, 0, 1] 2. 相反動作,最終樣式是 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]。
22.
Outline § The past
and now of JavaScript § A HTML with CSS and JavaScript § Common Type § Flow Control § Function § Advanced JavaScript 22
23.
if else § Condition:
==, ===, !=, >, < 23 1 2 3 4 5 6 7 if (condition1){ 当条件 1 为 true 时执行的代码} else if (condition2){ 当条件 2 为 true 时执行的代码 } else{ 当条件 1 和 条件 2 都不为 true 时执行的代码 }
24.
Try it! 24 § #練習:承上題,如果要把偶數放前⾯,奇數放後⾯該怎麼做? 結果像是
[0, 2, 4, 6, 8, 1, 3, 5, 7, 9]
25.
For Loop 25 1 2 3 for (var
i = 1;i < 5;i++) { console.log(i); }
26.
While Loop 26 1 2 3 while(true) { //
do sth in this infinity loop.. }
27.
Try it! 27 § #練習:在數學中,⽤
n! 來表⽰階乘,例如,4! =1×2×3×4 =24。 請計算 3!, 4!, 5!。
28.
Try it! 28 § #練習:"Please
count the character here."
29.
Try it! 29 § #練習:"Here
are UPPERCASE and lowercase chars."
30.
Try it! 30 § #練習:有一個
object { 0: ‘a’, 1: ‘b’, 2: ‘c’},我想要 key 與 value 互換變成 { ‘a’: 0, ‘b’: 1, ‘c’: 2}。 • Hint: Object.values(obj)=[‘a’, ‘b’, ‘c’], Object.keys(obj) = [0, 1, 2]
31.
Try it! 31 § #練習:畫幾個⾧條圖看看!
32.
Outline § The past
and now of JavaScript § A HTML with CSS and JavaScript § Common Type § Flow Control § Function § Advanced JavaScript 32
33.
declare a function 33 1 2 3 4 5 myFunction(Parameter1,Parameter2){ return
Parameter1,Parameter2; } myFunction(argument1,argument2);
34.
declare a function 34 1 2 3 4 5 function
myFunction(a,b) { return a*b; } console.log(myFunction(4,3));
35.
declare a function
as variable 35 1 2 3 4 5 6 7 var myFunction = function(Parameter1, Parameter2){ return Parameter1,Parameter2; } myFunction(argument1,argument2);
36.
this 36 1 2 3 4 5 6 A = function
A(){console.log(this);} A(); // Window B = {A: function A(){console.log(this);}} B.A(); // object B
37.
callback 37 1 2 3 4 5 6 7 8 9 10 11 12 13 14 function A(){ console.log('A1'); setTimeout( function(){
console.log("A2"); }, 1000 ); } function B(){ console.log('B1'); setTimeout( function(){ console.log('B2'); }, 1000 ); } A(); B();
38.
38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 function A(cb){ console.log('A1'); setTimeout( function(){
console.log("A2"); cb();}, 1000 ); } function B(){ console.log('B1'); setTimeout( function(){ console.log('B2'); }, 1000 ); } A(B); A(function (){ console.log('B1'); setTimeout( function(){ console.log('B2'); }, 1000 ); });
39.
Thanks for listening. 2017/06/27
(Wed.) JavaScript Beginner Tutorial Wei-Yuan Chang v123582@gmail.com v123582.github.io