document.write (use document.write() only to write directly into the document output: <script> document.write("<p>My First JavaScript</p>"); </script>
JavaScript statements are "commands" to the browser. The purpose of the statements is to tell the browser what to do:
document.getElementById("demo").innerHTML="Hello Dolly";
Tips/Useful points:
JavaScript is case sensitive
Comments with Javascript:
Single line comments start with //
Multi line comments start with /* and end with */.
JavaScript ignores extra spaces. You can add white space to your script to make it more readable.
You can break up a code line within a text string with a backslash (
Last Lesson:
Use of the Node.js Terminal (common commands & some shortcuts)
Variables
Data types (string data type & number data type)
Variables:
JavaScript variables are "containers" for storing information <script> var x=5; var y=6; var z=5+6;
Data Types
JavaScript variables can also hold other types of data, like text values (name="John Doe").
In JavaScript a text like "John Doe" is called a string. There are many types of JavaScript variables, but for now, just think of numbers and strings. <script> var pi=3.14; var name="John Doe"; var answer='Yes I am!';
Ok so far:
document.write (use document.write() only to write directly into the document output:
<script>
document.write("<p>My First JavaScript</p>");
</script>
JavaScript statements are "commands" to the browser. The purpose of the statements is to tell the browser what to do:
document.getElementById("demo").innerHTML="Hello Dolly";
Tips/Useful points:
- JavaScript is case sensitive
Comments with Javascript:Last Lesson:
Variables:
JavaScript variables are "containers" for storing information
<script>
var x=5;
var y=6;
var z=5+6;
document.write(x + "<br>");
document.write(y + "<br>");
document.write(z + "<br>");
</script>
Data Types
JavaScript variables can also hold other types of data, like text values (name="John Doe").
In JavaScript a text like "John Doe" is called a string. There are many types of JavaScript variables, but for now, just think of numbers and strings.
<script>
var pi=3.14;
var name="John Doe";
var answer='Yes I am!';
document.write(pi + "<br>");
document.write(name + "<br>");
document.write(answer + "<br>");
</script>
Today 23/11/2012
Sid's Github Link
https://github.com/siddMahen/learning-js/tree/master/lessons
Lessons topics remaining until Christmas Break