Coding JavaScript

This is a demonstration code in Javascript.

 

<!-- one could put javascripts on 3 places, the head section is one of these three -->

<script language="javascript">// <![CDATA[
document.write("this is a <b>sample</b> javascript work file
"); // this is a document.write entity
document.write("this is another line from document write"); // put comments in javascript this way
document.write("
");
document.write("
");
document.write("
");
var operand1 = 13; // variable initialization and variable declaration combined
var operand2 = 5; // second variable initialization and declaration
document.write("The operand1 variable has a value: "+ operand1);
document.write("
");
document.write("The operand2 variable has a value: "+ operand2);
document.write("
");
document.write("Integer Sum of operand2 and operand1 is: "+ (operand2+operand1)); // sum of two operands
document.write("
");
document.write("
");
documen.write("method_call on 
");
document.write("
"); // give this a break .. we can get going from here

/*
This is a multi-lined comment, anything placed here is ignored by the browser, meant to have long comments, and meant to be working only under the context of javascript block code.
*/
/* I will declare the variables under the script */
// ]]></script>
<script language="javascript">// <![CDATA[
document.write("this is a <b>sample</b> javascript work file
"); // this is a document.write entity
document.write("this is another line from document write"); // put comments in javascript this way
// ]]></script>

 

Advertisements

Looking for intellectual opinions. Feedbacks are welcome!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s