Professional Documents
Culture Documents
Annisa Farida
• Client-Side Scripting
• Intro to Javascript
• Programming with javascript
3. It’s Everywhere
7. User Interactions
8. Game Development
7
Gadjah Mada University 8
Object, Properties and Methods in JS
Properties are values associated with objects
Methods are actions that objects can perform
Object Properties Methods
car.color = white
around it
Event: It’s Raining!
JS Framework and Library
13
Gadjah Mada University
Gadjah Mada University 15
Gadjah Mada University 16
JS Scripting
KONSEP DAN LATIHAN JS CODING
17
How do we call JS?
Ingat CSS?
How? Examples
<style>
2 Embed in HTML #kucing {color:purple}
</style>
<script>
2 Embed in HTML window.alert(‘peringatan!’);
</script>
<button type="button"
onclick="document.getElementById('demo').inne
3 Inline html tag
rHTML = Date()">
Click me to display Date and Time.</button>
$.getScript("myscript.js", function(){
Import from other
Department of
4 JS
alert("Script loaded and executed.");
});
Explain these terms below:
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = 5 + 6;
</script>
</body>
</html>
• JavaScript is the programming language of the Web
• Javascript is an Object-Oriented Programming (OOP)
Language
• Javascript is Case-Sensitive
• Commonly used for Client-side scripting. Can be used for
Server-side scripting
• Derived from C language
• Highly dynamic in nature
• Javascript statement is ended with ;
Function
var x = myFunction(4, 3);
function myFunction(a, b) {
return a * b;
}
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus
++ Increment
-- Decrement
Assigment Operators
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
Javascript Demo
EXAMPLES ON JAVASCRIPT-POWERED WEBPAGE
34
What you can do with JS?
http://www.queness.com/post/12139/8-visually-
impressive-javascript-powered-websites
http://tutorialzine.com/2013/09/20-impressive-
examples-for-learning-webgl-with-three-js/
https://www.chromeexperiments.com/
http://mrdoob.github.io/three.js/examples/css3d_periodictable.html
http://wagerfield.github.io/parallax/
http://ogreen.special-t.com/en/
http://wellcaffeinated.net/PhysicsJS/examples/spaceship
http://globe.chromeexperiments.com/
http://threejs.org/
Menggunakan fungsi
Department of
GEODETIC ENGINEERING | Gadjah Mada University
Handling Event
Department of
GEODETIC ENGINEERING | Gadjah Mada University
Fungsi faktorial
Department of
GEODETIC ENGINEERING | Gadjah Mada University
• http://jsbooks.revolunet.com/
• w3schools
• http://eloquentjavascript.net/
• http://en.wikibooks.org/wiki/JavaScript
• http://www.utexas.edu/learn/javascript
• http://readwrite.com/2010/12/04/6-free-javascript-e-books
• http://www.webstepbook.com/supplements-
2ed/slides/chapter08-javascript.shtml
• http://xahlee.info/js/js_get_elements.html
• http://www.queness.com/post/12139/8-visually-impressive-
javascript-powered-websites