JavaScript Operations, JavaScript Tutorial, Global Guide Line Technology.
Bookmark Bookmark: JavaScript Operations, JavaScript Tutorial Forum | Blog |

      Home                    

Basic JavaScript Guide.
 JScript Introduction.            
 JScript Why?                       
 JScript Recognitions.          
 JScript onMouseover.         
 JScript with Buttons.           
 JScript Alerts.                     
 JScript Variables.               
 JScript Operators.               
 JScript Functions.               
 JScript Prompts.                 
 JScript Conditions.             
 JScript Validations.            
 JScript Confirmation Boxes.
 JScript Browser Detection.  
 JScript Redirection.            
 JScript on Links.                 
 JScript Switch.                    
 JScript Loops.                     
 JScript Events.                    
 JScript Exception Handling.
 JScript Reserve Characters. 
 JScript with Objects.            
 JScript Math Object.           
 JScript using Dates.             
 JScript using String.            
 JScript using Arrays.            
 JScript Operations.
 JScript Handling Cookies.   
 JScript in Mapping.             
 JScript Time Out.                
 JScript Summary.                

JavaScript Tutorial >> JavaScript Operations.


     Back             Next     


While using JavaScript, we need to know some other important things, may be these are not explained in all other segments of our JavaScript Tutorial.  Like below....

Case Sensitivity of JavaScript

In JavaScript naming  convention of JavaScript functions variables and objects matter with its case. Let's suppose we use a variable as "username" and we try to call it as "UserName" its totally invalid and will be the reason of generating an JavaScript exceptions. Hence JavaScript is case sensitive language.  So we must need to watch our capitalization closely while using the JavaScript variables names, function names, and object names.

White Spaces in JavaScript

JavaScript ignores the extra white spaces from the web browser. But we can add white spaces to our JavaScript code and this convention makes our code more reliable like the below two blocks are equal and the last one is preferred because of white spaces makes its quite easy to understand.

Examples of JavaScript White Spaces

Block One :
<script type="text/javascript">var date=new Date();document.write(date);</script>

Block Two :
<script type = "text/javascript">
  var date = new Date();
  document.write( date );
</script>
 

JavaScript Comments

Its good to use always comments in your JavaScript to explain for others and this convention is also helpful even for us in future.  Because forgetting is a human nature and if we forgot some thing and while we look at the comments we can understand what its happening.
We can add a JavaScript comments in our code with the start of // and this will make our single line as comment like below code.

Syntax for Single Line JavaScript Comment

<script type = "text/javascript">
  //This is a single line comment in JavaScript, we can write any tip help here.
  var date = new Date();
  document.write( date );
</script>

Or we can use /* for start and */ for end of multiple lines JavaScript comments like the blow code.

Example of Multiple Lines Comment in JavaScript

<script type = "text/javascript">
  /* This is a multiple lines comment,
     we can write any tip help here.
  */
  var date = new Date();
  document.write( date );
</script>

Breaking JavaScript Code in multiple lines

We can't break our JavaScript code in multiple lines but we can break only in case of JavaScript string like below code.

Example of breaking JavaScript code in muliple lines

<script type = "text/javascript">
  document.write( "JavaScript Tutorial at /
  Global Guide Line  Technology" );
</script>

Breaking JavaScript Alert in multiple lines

We can also break our JavaScript alerts into multiple lines like the below code example

<script type = "text/javascript">
  alert("JavaScript" + '\n' + "Tutorial" + '\n' + "Global" + '\n' + " Guide "
  + '\n'  + " Line " + '\n' + " Technology ") ;
</script>


     Back             Next     
 

JavaScript Statement, JavaScript Block and JavaScript Comments Examples



JavaScript Alert, Confirmation and Prompt Boxes Examples



[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2018 www.globalguideline.com All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 186 visitors are online now