SlideShare a Scribd company logo
ALGORITHMS, COMPUTER GRAPHICS,
AND MATHEMATICS FOR GAME
DEVELOPERS & COMPUTER
SCIENTISTS
Class[2]: Introduction to JavaScript [Part 1]
PREPARED AND PRESENTED BY
Dr.Saajid Abuluaih, PhD
30th of May, 2021
Algorithms, Computer Graphics, and Mathematics
for Game Developers and Computer Scientists
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
2
Agenda
One-Bite Wisdom
JS Syntax: Variables & Operators
JS Syntax: Conditional Statements
𝑖
JS Syntax: Loops
Introduction to JS: Brief
JS Syntax: Functions
Today’s Algorithm
𝑔
𝑛
“The future is not just unwritten - it is unsearched”
-Bruce Sterling
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 3
One-Bite Wisdom
RHIND PAPYRUS
4
ANCIENT EGYPTIAN MATH RIDDLE,
RHIND MATHEMATICAL PAPYRUS
References:
Math Puzzles’ Oldest Ancestors Took Form on Egyptian Papyrus
Episode Transcript – Episode 17 - Rhind Mathematical Papyrus
Rhind papyrus
In seven houses there are seven cats. Each cat catches seven
mice. Each mouse would have eaten seven ears of corn and
each ear of corn, if sown, would have produced seven gallons
of grain. How many things are mentioned in total?
(made around 3,500 years ago)
5
ANCIENT EGYPTIAN MATH RIDDLE,
RHIND MATHEMATICAL PAPYRUS
References:
Math Puzzles’ Oldest Ancestors Took Form on Egyptian Papyrus
Episode Transcript – Episode 17 - Rhind Mathematical Papyrus
Rhind papyrus
In seven houses there are seven cats. Each cat catches seven
mice. Each mouse would have eaten seven ears of corn and
each ear of corn, if sown, would have produced seven gallons
of grain. How many things are mentioned in total?
(made around 3,500 years ago)
The answer is as easy as:
7 + 72 + 73 + 74 + 75
Algorithms, Computer Graphics, and Mathematics
for Game Developers and Computer Scientists
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
WHAT THAT HAS TO DO WITH
OUR CLASS FOR TODAY?
NOTHING
it has nothing to do with today’s class
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 7
Simple Algorithms
Let’s Brush our Coding Skills
Given a string, replace each its character by the next one in the English alphabet (z would be replaced by
a). Example: Example: “o`kdrshmd”, the output should be “palestine”
8
A SIMPLE ALGORITHM,
Alphabet Shifter
Given a string, replace each its character by the next one in the English alphabet (z would be replaced by
a). Example: “o`kdrshmd”, the output should be “palestine”
• Method [1] (Stupid):
9
A SIMPLE ALGORITHM,
Alphabet Shifter
function Alphabet_Shift(str) {
var dictionary = {
'a' : 'b', 'b' : 'c', 'c' : 'd', 'd' : 'e', 'e' : 'f', 'f' : 'g',
'g' : 'h', 'h' : 'i', 'i' : 'j', 'j' : 'k', 'k' : 'l', 'l' : 'm',
'm' : 'n', 'n' : 'o', 'o' : 'p', 'p' : 'q', 'q' : 'r', 'r' : 's',
's' : 't', 't' : 'u', 'u' : 'v', 'v' : 'w', 'w' : 'x', 'x' : 'y',
'y' : 'z', 'z' : 'a’};
var temp = str.split('');
for(var i=0; i<temp.length; i++){
temp[i] = dictionary[temp[i]]
}
return temp.join("");
}
Given a string, replace each its character by the next one in the English alphabet (z would be replaced by
a). Example: “o`kdrshmd”, the output should be “palestine”
• Method [2] (smarter solution):
10
A SIMPLE ALGORITHM,
Alphabet Shifter
function alphabet_char_Shift(str) {
var all_chars = str.split('');
for(var i = 0; i < all_chars.length; i++) {
var n = all_chars[i].charCodeAt() - 'a'.charCodeAt();
n = (n + 1) % 26;
all_chars[i] = String.fromCharCode(n + 'a'.charCodeAt());
}
return all_chars.join("");
}
console.log(alphabet_char_Shift("o`kdrshmd"))
References:
Look at the following solution to see how do they solve the ‘z’ letter.
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 11
Introduction
What is JavaScript anyway?
The early to mid-1990s were a pivotal period in the history of the internet. Browser wars were raging
between major players like Netscape and Microsoft, with Netscape's Navigator and Microsoft's Internet
Explorer going head-to-head.
Due to the rapid growth of JavaScript, it became evident in 1997 that the language would need to be
properly maintained and managed. As a result, Netscape delegated the task of developing a language
definition to the European Computer Manufacturers Association (ECMA), an organization dedicated to
computer standardization.
12
INTRODUCTION,
BRIEF HISTORY
References:
The History of JavaScript: Everything You Need to Know
Netscape Navigator 2
- JavaScript was developed by NetScape to provide functionality to their internet browser in 1995
- Netscape handed the job of creating a language specification to the European Computer
Manufacturers Association (ECMA)
JavaScript is a scripting language designed for building interactive functionalities to websites. It is one of
the three most common languages for web development. Unlike HTML and CSS, which offer a website's
structure and appearance, JavaScript allows you to programs functionality and handle event behaviors to
webpages, allowing visitors to interact with page’s contents.
JavaScript is designed to operate on client-side. That means, the browser receives a copy of the source
code and runs it on the client machine within the browser environment. However, recently the
introduction of Node.js, JavaScript can now execute code on servers as well.
13
INTRODUCTION,
WHAT THIS COURSE IS ALL ABOUT
- HTML: is a markup language for
managing the contents
- CSS: cascading style sheet for styling
webpages contents
- JavaScript: programing language for
webpabes
- Most likely to be used as a Client-Side
Programming language
- JavaScript is an interpreter not a compiler
- JavaScript is a case-sensitive language
- JavaScript is a whitespace insensitive
- JavaScript has nothing to do with Java
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 14
JavaScript
Language Syntax: Variables & Operators
The structure of delivering classes:
• Single line comment //
• Multi-lines comment /* */
15
JS SYNTAX,
COMMENTS
To store values, you can use variables. There are three primitive data types, and they are: Numbers,
Strings, and Booleans.
• Declare variables using var keyword, or the key word let (Homework: what is the differences between
them both?)
• You can use the const keyword to define variable that cannot be reassigned
var x = 5;
var y = 6;
var z = x + y;
const pi = 3.14;
let personFirstName = "Hiroyuki";
let personLastName = 'Iida’;
let personFullName = personFirstName + " " + personLastName;
var bool1 = true;
var bool2 = 11 < 10;
var arr = [true, 'true', 1];
16
JS SYNTAX,
VARIABLES DECLARATION & TYPES [1]
Objects is one of the most common variable types used in the language.
var car = {type:"Toyota", model:"500", color:"white"};
The Key:Value pairs in JavaScript objects are called properties
You can access object’s properties using the following two methods:
• car.type
• car["type"]
An object can have functions as well:
var car = {
type:"Toyota",
model:"500",
color:"white",
fullInfo:function() {
return this.type + " " + this.model + " " + this.color;
}
};
17
JS SYNTAX,
VARIABLES DECLARATION & TYPES [2]
Arithmetic operators are used to perform arithmetic on values of type numbers.
18
JS SYNTAX,
OPERATORS [PART 1]
Operator Description
+ Addition
- Subtraction
* Multiplication
** Exponentiation
/ Division
% Modulus (Division Remainder)
++ Increment
-- Decrement
Operator Example Same As
= x = y x = y
+= x += y x = x + y
-= x -= y x = x - y
*= x *= y x = x * y
/= x /= y x = x / y
%= x %= y x = x % y
**= x **= y x = x ** y
Can you tell the difference of the following statements?
var x = 5;
x++;
var y = 6;
++y;
Comparison and Logical operators are used to test a statement to check whether it is true or false.
19
JS SYNTAX,
OPERATORS [PART 2]
Operator Description
== equal to
=== equal value and equal type
!= not equal
!== not equal value or not equal type
> greater than
< less than
>= greater than or equal to
<= less than or equal to
? ternary operator
Operator Description
&& logical and
|| logical or
! logical not
Can you tell the difference of the following statements?
var voltage = (volt == 110) ? "low voltage" : "high voltage";
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 20
JavaScript
Language Syntax: Conditional Statement
Conditional statement is a set of rules performed if a certain
set of constraints is met (IF a set of constraints is true THEN
perform the following rules).
if (Condition) {
statements;
}
if (Condition) {
statements;
} else {
statements;
}
21
JS SYNTAX,
CONDITIONAL STATEMENT [1]
Start
Condition
Execute the
following set of rules
End
Start
Condition
Execute the
following set of rules
End
Execute another set
of rules
True
False
False
True
Switch statement is used to perform a set of actions based on
different sets of conditions
var day = "";
switch (dayNum) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
default:
day = " undefined";
}
22
JS SYNTAX,
CONDITIONAL STATEMENT [2]
Start
Condition
Execute the
following set of rules
End
False
True
Condition
Execute the
following set of rules
False
True
Condition
Execute the
following set of rules
False
True
Execute the default
set of rules
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 23
JavaScript
Language Syntax: Loop Statement
Loops used to repeat a specific block of code until some condition
is met.
for (i = 0; i < length; i++) {
statements;
}
You can move more than one step at a time.
There are the following loops that works with arrays and objects:
var obj = {prop1:"Hiroyuki", prop2:"Iida"};
var fullName = ""; var x;
for (x in obj) { fullName += obj[x] + " "; }
let arr = ["elm1", "elm2", "elm3"];
let text = "";
for (let x of cars) { text += x + " ";}
24
JS SYNTAX,
LOOPS STATEMENT [1]
Start
Condition
Execute the
following set of rules
End
True
False
Loops used to repeat a specific block of code until some
condition is met.
while (i < 10) {
text += "i = " + i;
i++;
}
do {
text += "The number is " + i;
i++;
}
while (i < 10);
25
JS SYNTAX,
LOOPS STATEMENT [2]
Start
Condition
Execute the
following set of rules
End
True
False
Start
Condition
Execute the
following set of rules
End
True
False
Break and Continue are used to skip or break the loop if upon request
for (i = 0; i < 10; i++) {
if (i === 5)
break;
text += "i = " + i;
}
for (i = 0; i < 10; i++) {
if (i === 5)
continue;
text += "i = " + i;
}
26
JS SYNTAX,
LOOPS STATEMENT [3]
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 27
JavaScript
Language Syntax: Functions
A JavaScript function is a block of code designed to perform a particular task.
function printMessage() {
console.log("JS is a great language");
}
printMessage();
function times(num1, num2) {
console.log("The first number time the second number = " + num1 * num2);
}
time(5, 4);
function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
var Cel = toCelsius(95);
28
JS SYNTAX,
FUNCTIONS
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
P A G E 29
HOMEWORK
Let's Exercise What We've Learned
Write a JS code for solving a problem of your choice that contains all the statements you’ve learned today
30
DEADLINE 6/6,
HOMEWORK
Algorithms, Computer Graphics, and Mathematics
for Game Developers and Computer Scientists
© 2021 arche1.co.jp | jaist.ac.jp
All rights reserved.
THANKS FOR YOUR
ATTENTION

More Related Content

What's hot

Kotlin
KotlinKotlin
Constructors destructors
Constructors destructorsConstructors destructors
Constructors destructors
Pranali Chaudhari
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
Ilio Catallo
 
Introduction to Smalltalk
Introduction to SmalltalkIntroduction to Smalltalk
Introduction to Smalltalk
kim.mens
 
Textual Modeling Framework Xtext
Textual Modeling Framework XtextTextual Modeling Framework Xtext
Textual Modeling Framework Xtext
Sebastian Zarnekow
 
Smalltalk, the dynamic language
Smalltalk, the dynamic languageSmalltalk, the dynamic language
Smalltalk, the dynamic language
mohamedsamyali
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
Diksha Bhargava
 
Parte II Objective C
Parte II   Objective CParte II   Objective C
Parte II Objective C
Paolo Quadrani
 
Maths&programming forartists wip
Maths&programming forartists wipMaths&programming forartists wip
Maths&programming forartists wip
kedar nath
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific Languages
Javier Canovas
 
Aspdot
AspdotAspdot
3. Java Script
3. Java Script3. Java Script
3. Java Script
Jalpesh Vasa
 
Mel for beginners
Mel for beginnersMel for beginners
Mel for beginners
kedar nath
 
Extending the Xbase Typesystem
Extending the Xbase TypesystemExtending the Xbase Typesystem
Extending the Xbase Typesystem
Sebastian Zarnekow
 
javascript
javascript javascript
javascript
Kaya Ota
 
Oops presentation
Oops presentationOops presentation
Oops presentation
sushamaGavarskar1
 
Javascript
JavascriptJavascript
Javascript
guest03a6e6
 
Python for katana
Python for katanaPython for katana
Python for katana
kedar nath
 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
Amr Elghadban (AmrAngry)
 
Classes1
Classes1Classes1
Classes1
phanleson
 

What's hot (20)

Kotlin
KotlinKotlin
Kotlin
 
Constructors destructors
Constructors destructorsConstructors destructors
Constructors destructors
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
 
Introduction to Smalltalk
Introduction to SmalltalkIntroduction to Smalltalk
Introduction to Smalltalk
 
Textual Modeling Framework Xtext
Textual Modeling Framework XtextTextual Modeling Framework Xtext
Textual Modeling Framework Xtext
 
Smalltalk, the dynamic language
Smalltalk, the dynamic languageSmalltalk, the dynamic language
Smalltalk, the dynamic language
 
Objective c slide I
Objective c slide IObjective c slide I
Objective c slide I
 
Parte II Objective C
Parte II   Objective CParte II   Objective C
Parte II Objective C
 
Maths&programming forartists wip
Maths&programming forartists wipMaths&programming forartists wip
Maths&programming forartists wip
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific Languages
 
Aspdot
AspdotAspdot
Aspdot
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
Mel for beginners
Mel for beginnersMel for beginners
Mel for beginners
 
Extending the Xbase Typesystem
Extending the Xbase TypesystemExtending the Xbase Typesystem
Extending the Xbase Typesystem
 
javascript
javascript javascript
javascript
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
Javascript
JavascriptJavascript
Javascript
 
Python for katana
Python for katanaPython for katana
Python for katana
 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
 
Classes1
Classes1Classes1
Classes1
 

Similar to Class[2][29th may] [javascript]

Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
Skills Matter
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011
Agora Group
 
Java se-7-evolves-toulouse-jug-2001-09-14
Java se-7-evolves-toulouse-jug-2001-09-14Java se-7-evolves-toulouse-jug-2001-09-14
Java se-7-evolves-toulouse-jug-2001-09-14
Baptiste Mathus
 
mloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentmloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game development
David Galeano
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
Bala Narayanan
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
Mark Stoodley
 
CS101- Introduction to Computing- Lecture 35
CS101- Introduction to Computing- Lecture 35CS101- Introduction to Computing- Lecture 35
CS101- Introduction to Computing- Lecture 35
Bilal Ahmed
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
RazanMazen4
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
RazanMazen4
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
RazanMazen4
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
Eugene Lazutkin
 
Class[3][5th jun] [three js]
Class[3][5th jun] [three js]Class[3][5th jun] [three js]
Class[3][5th jun] [three js]
Saajid Akram
 
An Intoduction to R
An Intoduction to RAn Intoduction to R
An Intoduction to R
Mahmoud Shiri Varamini
 
22 Jop Oct 08
22 Jop Oct 0822 Jop Oct 08
22 Jop Oct 08
Ganesh Samarthyam
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
WondimuBantihun1
 
Practical Groovy DSL
Practical Groovy DSLPractical Groovy DSL
Practical Groovy DSL
Guillaume Laforge
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....
Raffi Krikorian
 
JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020
Joseph Kuo
 
Lab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer GraphicsLab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer Graphics
Rup Chowdhury
 
Project seminar ppt_steelcasting
Project seminar ppt_steelcastingProject seminar ppt_steelcasting
Project seminar ppt_steelcasting
Rudra Narayan Paul
 

Similar to Class[2][29th may] [javascript] (20)

Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011
 
Java se-7-evolves-toulouse-jug-2001-09-14
Java se-7-evolves-toulouse-jug-2001-09-14Java se-7-evolves-toulouse-jug-2001-09-14
Java se-7-evolves-toulouse-jug-2001-09-14
 
mloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game developmentmloc.js 2014 - JavaScript and the browser as a platform for game development
mloc.js 2014 - JavaScript and the browser as a platform for game development
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
CS101- Introduction to Computing- Lecture 35
CS101- Introduction to Computing- Lecture 35CS101- Introduction to Computing- Lecture 35
CS101- Introduction to Computing- Lecture 35
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
 
04-JS.pptx
04-JS.pptx04-JS.pptx
04-JS.pptx
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
Class[3][5th jun] [three js]
Class[3][5th jun] [three js]Class[3][5th jun] [three js]
Class[3][5th jun] [three js]
 
An Intoduction to R
An Intoduction to RAn Intoduction to R
An Intoduction to R
 
22 Jop Oct 08
22 Jop Oct 0822 Jop Oct 08
22 Jop Oct 08
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Practical Groovy DSL
Practical Groovy DSLPractical Groovy DSL
Practical Groovy DSL
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....
 
JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020
 
Lab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer GraphicsLab Practices and Works Documentation / Report on Computer Graphics
Lab Practices and Works Documentation / Report on Computer Graphics
 
Project seminar ppt_steelcasting
Project seminar ppt_steelcastingProject seminar ppt_steelcasting
Project seminar ppt_steelcasting
 

More from Saajid Akram

Workshop[22nd august][assignments]
Workshop[22nd august][assignments]Workshop[22nd august][assignments]
Workshop[22nd august][assignments]
Saajid Akram
 
Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]
Saajid Akram
 
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Saajid Akram
 
Class[4][19th jun] [three js-camera&amp;light]
Class[4][19th jun] [three js-camera&amp;light]Class[4][19th jun] [three js-camera&amp;light]
Class[4][19th jun] [three js-camera&amp;light]
Saajid Akram
 
Class[1][23ed may] [algorithms]
Class[1][23ed may] [algorithms]Class[1][23ed may] [algorithms]
Class[1][23ed may] [algorithms]
Saajid Akram
 
Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]
Saajid Akram
 
Workshop[1st apr]-[introduction]
Workshop[1st apr]-[introduction] Workshop[1st apr]-[introduction]
Workshop[1st apr]-[introduction]
Saajid Akram
 

More from Saajid Akram (7)

Workshop[22nd august][assignments]
Workshop[22nd august][assignments]Workshop[22nd august][assignments]
Workshop[22nd august][assignments]
 
Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]Class[6][5th aug] [three js-loaders]
Class[6][5th aug] [three js-loaders]
 
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
 
Class[4][19th jun] [three js-camera&amp;light]
Class[4][19th jun] [three js-camera&amp;light]Class[4][19th jun] [three js-camera&amp;light]
Class[4][19th jun] [three js-camera&amp;light]
 
Class[1][23ed may] [algorithms]
Class[1][23ed may] [algorithms]Class[1][23ed may] [algorithms]
Class[1][23ed may] [algorithms]
 
Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]Workshop[3ed Apr]-[Git]
Workshop[3ed Apr]-[Git]
 
Workshop[1st apr]-[introduction]
Workshop[1st apr]-[introduction] Workshop[1st apr]-[introduction]
Workshop[1st apr]-[introduction]
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 

Class[2][29th may] [javascript]

  • 1. ALGORITHMS, COMPUTER GRAPHICS, AND MATHEMATICS FOR GAME DEVELOPERS & COMPUTER SCIENTISTS Class[2]: Introduction to JavaScript [Part 1] PREPARED AND PRESENTED BY Dr.Saajid Abuluaih, PhD 30th of May, 2021
  • 2. Algorithms, Computer Graphics, and Mathematics for Game Developers and Computer Scientists © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. 2 Agenda One-Bite Wisdom JS Syntax: Variables & Operators JS Syntax: Conditional Statements 𝑖 JS Syntax: Loops Introduction to JS: Brief JS Syntax: Functions Today’s Algorithm 𝑔 𝑛 “The future is not just unwritten - it is unsearched” -Bruce Sterling
  • 3. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 3 One-Bite Wisdom RHIND PAPYRUS
  • 4. 4 ANCIENT EGYPTIAN MATH RIDDLE, RHIND MATHEMATICAL PAPYRUS References: Math Puzzles’ Oldest Ancestors Took Form on Egyptian Papyrus Episode Transcript – Episode 17 - Rhind Mathematical Papyrus Rhind papyrus In seven houses there are seven cats. Each cat catches seven mice. Each mouse would have eaten seven ears of corn and each ear of corn, if sown, would have produced seven gallons of grain. How many things are mentioned in total? (made around 3,500 years ago)
  • 5. 5 ANCIENT EGYPTIAN MATH RIDDLE, RHIND MATHEMATICAL PAPYRUS References: Math Puzzles’ Oldest Ancestors Took Form on Egyptian Papyrus Episode Transcript – Episode 17 - Rhind Mathematical Papyrus Rhind papyrus In seven houses there are seven cats. Each cat catches seven mice. Each mouse would have eaten seven ears of corn and each ear of corn, if sown, would have produced seven gallons of grain. How many things are mentioned in total? (made around 3,500 years ago) The answer is as easy as: 7 + 72 + 73 + 74 + 75
  • 6. Algorithms, Computer Graphics, and Mathematics for Game Developers and Computer Scientists © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. WHAT THAT HAS TO DO WITH OUR CLASS FOR TODAY? NOTHING it has nothing to do with today’s class
  • 7. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 7 Simple Algorithms Let’s Brush our Coding Skills
  • 8. Given a string, replace each its character by the next one in the English alphabet (z would be replaced by a). Example: Example: “o`kdrshmd”, the output should be “palestine” 8 A SIMPLE ALGORITHM, Alphabet Shifter
  • 9. Given a string, replace each its character by the next one in the English alphabet (z would be replaced by a). Example: “o`kdrshmd”, the output should be “palestine” • Method [1] (Stupid): 9 A SIMPLE ALGORITHM, Alphabet Shifter function Alphabet_Shift(str) { var dictionary = { 'a' : 'b', 'b' : 'c', 'c' : 'd', 'd' : 'e', 'e' : 'f', 'f' : 'g', 'g' : 'h', 'h' : 'i', 'i' : 'j', 'j' : 'k', 'k' : 'l', 'l' : 'm', 'm' : 'n', 'n' : 'o', 'o' : 'p', 'p' : 'q', 'q' : 'r', 'r' : 's', 's' : 't', 't' : 'u', 'u' : 'v', 'v' : 'w', 'w' : 'x', 'x' : 'y', 'y' : 'z', 'z' : 'a’}; var temp = str.split(''); for(var i=0; i<temp.length; i++){ temp[i] = dictionary[temp[i]] } return temp.join(""); }
  • 10. Given a string, replace each its character by the next one in the English alphabet (z would be replaced by a). Example: “o`kdrshmd”, the output should be “palestine” • Method [2] (smarter solution): 10 A SIMPLE ALGORITHM, Alphabet Shifter function alphabet_char_Shift(str) { var all_chars = str.split(''); for(var i = 0; i < all_chars.length; i++) { var n = all_chars[i].charCodeAt() - 'a'.charCodeAt(); n = (n + 1) % 26; all_chars[i] = String.fromCharCode(n + 'a'.charCodeAt()); } return all_chars.join(""); } console.log(alphabet_char_Shift("o`kdrshmd")) References: Look at the following solution to see how do they solve the ‘z’ letter.
  • 11. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 11 Introduction What is JavaScript anyway?
  • 12. The early to mid-1990s were a pivotal period in the history of the internet. Browser wars were raging between major players like Netscape and Microsoft, with Netscape's Navigator and Microsoft's Internet Explorer going head-to-head. Due to the rapid growth of JavaScript, it became evident in 1997 that the language would need to be properly maintained and managed. As a result, Netscape delegated the task of developing a language definition to the European Computer Manufacturers Association (ECMA), an organization dedicated to computer standardization. 12 INTRODUCTION, BRIEF HISTORY References: The History of JavaScript: Everything You Need to Know Netscape Navigator 2 - JavaScript was developed by NetScape to provide functionality to their internet browser in 1995 - Netscape handed the job of creating a language specification to the European Computer Manufacturers Association (ECMA)
  • 13. JavaScript is a scripting language designed for building interactive functionalities to websites. It is one of the three most common languages for web development. Unlike HTML and CSS, which offer a website's structure and appearance, JavaScript allows you to programs functionality and handle event behaviors to webpages, allowing visitors to interact with page’s contents. JavaScript is designed to operate on client-side. That means, the browser receives a copy of the source code and runs it on the client machine within the browser environment. However, recently the introduction of Node.js, JavaScript can now execute code on servers as well. 13 INTRODUCTION, WHAT THIS COURSE IS ALL ABOUT - HTML: is a markup language for managing the contents - CSS: cascading style sheet for styling webpages contents - JavaScript: programing language for webpabes - Most likely to be used as a Client-Side Programming language - JavaScript is an interpreter not a compiler - JavaScript is a case-sensitive language - JavaScript is a whitespace insensitive - JavaScript has nothing to do with Java
  • 14. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 14 JavaScript Language Syntax: Variables & Operators
  • 15. The structure of delivering classes: • Single line comment // • Multi-lines comment /* */ 15 JS SYNTAX, COMMENTS
  • 16. To store values, you can use variables. There are three primitive data types, and they are: Numbers, Strings, and Booleans. • Declare variables using var keyword, or the key word let (Homework: what is the differences between them both?) • You can use the const keyword to define variable that cannot be reassigned var x = 5; var y = 6; var z = x + y; const pi = 3.14; let personFirstName = "Hiroyuki"; let personLastName = 'Iida’; let personFullName = personFirstName + " " + personLastName; var bool1 = true; var bool2 = 11 < 10; var arr = [true, 'true', 1]; 16 JS SYNTAX, VARIABLES DECLARATION & TYPES [1]
  • 17. Objects is one of the most common variable types used in the language. var car = {type:"Toyota", model:"500", color:"white"}; The Key:Value pairs in JavaScript objects are called properties You can access object’s properties using the following two methods: • car.type • car["type"] An object can have functions as well: var car = { type:"Toyota", model:"500", color:"white", fullInfo:function() { return this.type + " " + this.model + " " + this.color; } }; 17 JS SYNTAX, VARIABLES DECLARATION & TYPES [2]
  • 18. Arithmetic operators are used to perform arithmetic on values of type numbers. 18 JS SYNTAX, OPERATORS [PART 1] Operator Description + Addition - Subtraction * Multiplication ** Exponentiation / Division % Modulus (Division Remainder) ++ Increment -- Decrement Operator Example Same As = x = y x = y += x += y x = x + y -= x -= y x = x - y *= x *= y x = x * y /= x /= y x = x / y %= x %= y x = x % y **= x **= y x = x ** y Can you tell the difference of the following statements? var x = 5; x++; var y = 6; ++y;
  • 19. Comparison and Logical operators are used to test a statement to check whether it is true or false. 19 JS SYNTAX, OPERATORS [PART 2] Operator Description == equal to === equal value and equal type != not equal !== not equal value or not equal type > greater than < less than >= greater than or equal to <= less than or equal to ? ternary operator Operator Description && logical and || logical or ! logical not Can you tell the difference of the following statements? var voltage = (volt == 110) ? "low voltage" : "high voltage";
  • 20. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 20 JavaScript Language Syntax: Conditional Statement
  • 21. Conditional statement is a set of rules performed if a certain set of constraints is met (IF a set of constraints is true THEN perform the following rules). if (Condition) { statements; } if (Condition) { statements; } else { statements; } 21 JS SYNTAX, CONDITIONAL STATEMENT [1] Start Condition Execute the following set of rules End Start Condition Execute the following set of rules End Execute another set of rules True False False True
  • 22. Switch statement is used to perform a set of actions based on different sets of conditions var day = ""; switch (dayNum) { case 0: day = "Sunday"; break; case 1: day = "Monday"; break; case 2: day = "Tuesday"; break; case 3: day = "Wednesday"; break; default: day = " undefined"; } 22 JS SYNTAX, CONDITIONAL STATEMENT [2] Start Condition Execute the following set of rules End False True Condition Execute the following set of rules False True Condition Execute the following set of rules False True Execute the default set of rules
  • 23. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 23 JavaScript Language Syntax: Loop Statement
  • 24. Loops used to repeat a specific block of code until some condition is met. for (i = 0; i < length; i++) { statements; } You can move more than one step at a time. There are the following loops that works with arrays and objects: var obj = {prop1:"Hiroyuki", prop2:"Iida"}; var fullName = ""; var x; for (x in obj) { fullName += obj[x] + " "; } let arr = ["elm1", "elm2", "elm3"]; let text = ""; for (let x of cars) { text += x + " ";} 24 JS SYNTAX, LOOPS STATEMENT [1] Start Condition Execute the following set of rules End True False
  • 25. Loops used to repeat a specific block of code until some condition is met. while (i < 10) { text += "i = " + i; i++; } do { text += "The number is " + i; i++; } while (i < 10); 25 JS SYNTAX, LOOPS STATEMENT [2] Start Condition Execute the following set of rules End True False Start Condition Execute the following set of rules End True False
  • 26. Break and Continue are used to skip or break the loop if upon request for (i = 0; i < 10; i++) { if (i === 5) break; text += "i = " + i; } for (i = 0; i < 10; i++) { if (i === 5) continue; text += "i = " + i; } 26 JS SYNTAX, LOOPS STATEMENT [3]
  • 27. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 27 JavaScript Language Syntax: Functions
  • 28. A JavaScript function is a block of code designed to perform a particular task. function printMessage() { console.log("JS is a great language"); } printMessage(); function times(num1, num2) { console.log("The first number time the second number = " + num1 * num2); } time(5, 4); function toCelsius(fahrenheit) { return (5/9) * (fahrenheit-32); } var Cel = toCelsius(95); 28 JS SYNTAX, FUNCTIONS
  • 29. © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. P A G E 29 HOMEWORK Let's Exercise What We've Learned
  • 30. Write a JS code for solving a problem of your choice that contains all the statements you’ve learned today 30 DEADLINE 6/6, HOMEWORK
  • 31. Algorithms, Computer Graphics, and Mathematics for Game Developers and Computer Scientists © 2021 arche1.co.jp | jaist.ac.jp All rights reserved. THANKS FOR YOUR ATTENTION