Introduction To JavaScript I
Introduction To JavaScript I
DBAV
Introduction to JavaScript I
Week 03.
SOFTWARE CLUSTER
[ CDEV • Coding and Development Project ] [ DBAV • Database Applicati on Development ] 1
Objectives
4
A Brief History of JavaScript
• Google Chrome
• Console
• Chrome Canary: Developer version of Chrome
• Firefox
• Firebug (Add-on)
• Safari
• Console: Web Inspector (need to enable Developer mode in Preferences -> Advanced)
• Webkit Nightly: Developer version
• Internet Explorer
• F12 Developer Tools
You will use a browser built-in tool called JavaScript Console to help you learn JavaScript.
Mac OS X Windows
• W3Schools
• http://www.w3schools.com/js/default.asp
• Mozilla Developer Network
• http://developer.mozilla.org/en-US/docs/Web/JavaScript
• JavaScript: The Good Parts by Douglas Crockford
• Google: Chrome Developer Tools
• http://developers.google.com/chrome-developer-tools
• Firefox: Firebug Wiki
• http://getfirebug.com/wiki
13
Variables
• Create a new HTML file in Visual Studio Code or any other editor.
• Write a small script in the HTML file to calculate the circumference ()
and area () of a circle.
• Create a variable to store the radius
• Calculate the circumference based on the radius and output “The
circumference is ??”
• Calculate the area based on the radius and output “The area is ??”
• Hint: You can use a built-in JavaScript constant Math.PI to get the value of .
• Load the HTML file and see your output in the JavaScript Console.
• Create a new JavaScript file in Visual Studio Code or any other editor.
The file must end with “.js” extension. E.g. myscript.js
• Copy the script that you wrote previously to your JavaScript file.
• In the previous HTML file, remove the JavaScript source codes and
replace with a link to your JavaScript file in the script tag.
• Load the HTML file in the browser and see your output in the
JavaScript Console.
26
Conditions: if Statement
31