Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions javascript where to declare variables
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
javascript where to declare variables
2 Answer(s)      2 years and 5 months ago
Posted in : JavaScript Questions


javascript where to declare variables


Advertisement
View Answers

April 4, 2012 at 4:36 PM


Javascript variable always be declared inside script tag.

<script>
var x=15;
var y=16;
var sum=x+y;
document.writeln("Sum ="+sum);
</script>

For more information, visit the following link:

Declare variables in Javascript



April 4, 2012 at 4:38 PM


JavaScript where to declare variables

To declare a variable in JavaScript me must follow the syntax. As given below

Syntax

<script language="javascript">

//  declare variable or do your calculation

  </script>"

See an example given below that show how to declare a variable in JavaScript.

<Script Language="JavaScript">

var name, age;

name = Java;
age = 7;
document.write(name);
document.write("<br>");
document.write(age);
</Script>

In the above example name and age are two variable and further we have assigned some value to it. Always remember that the variable name must be written in small letters. document.write (); is used to print the value of variable.



Related Tutorials/Questions & Answers:
javascript where to declare variables
variables in Javascript   JavaScript where to declare variables To declare...javascript where to declare variables  javascript where to declare variables   Javascript variable always be declared inside script tag
JavaScript Variables
JavaScript Variables: Variables are like containers, which contains a value. In JavaScript variables dependent on the value, not on the datatype that means...; Variables in JavaScript </title> </head> <body> <
Advertisements
What is JavaScript Variables ?
What is JavaScript Variables ?  Hi, My question is that What is Variable in JavaScript Programming Language. How to declare variables in JavaScript Program. Thanks
JavaScript where to place in HTML
JavaScript where to place in HTML   Where to place JavaScript code into HTML Code?   Placing JavaScript code into HTML Code In HTML, JavaScript can be declared anywhere either in <Head>? or <Body>? Tag
how to get javascript variables into jsp - JSP-Servlet
how to get javascript variables into jsp  How to pass variables from java script into jsp page  Hi Friend, Try it: 1)pass.jsp: var msg="Hello World" window.location.href="show.jsp?value=" + msg
Variables
Variables  What are the difference between Static variables, instance variables and local variables
PHP Variables in JavaScript
PHP Variables in JavaScript JavaScript and PHP both are scripting language for the web. Moreover, JavaScript is basically  a client side scripting... on the internet. Let's see how can you use PHP variables in JavaScript. For example
Declare construct
Declare construct  hii, Define about declare construct?   hello, Declare construct allows you to define execution directives for a block.... These declare construct can be set in such a manner that all the code is affected
Variables in Java
Before using variables you must declare the variables  name and type. See... Variables in Java       In this section, you will learn about Java variables
Declare the Navigation Rules
Declare the Navigation Rules  How to declare the Navigation Rules for JSF
PHP Variable variables
PHP Variables variable: Variables variable is a new kind of technique of using variables, in this technique we need to use more than one variable and we can use those variables dynamically. As in the following examples we can see
How to declare NSMatrix
How to declare NSMatrix  How to declare NSMatrix in XCode can anyone explain it with example
Declare Cursors in SQL
Declare Cursors in SQL       Declare Cursors in SQL is used to define cursor and its... 'Declare Cursors in SQL'. To grasp the example, we create a table 'Stu_Table
How to Declare Abstract Class in PHP ?
How to Declare Abstract Class in PHP ?  hi, I am a PHP Beginners. As i am trying to make an application where i trying to declare the abstract class of PHP. Please any one explain me how to declare abstract class in PHP program
how do i update my database with the help of update syntax in html <text/javascript>? How to write 'where' statement in this?
how do i update my database with the help of update syntax in html ? How to write 'where' statement in this?  var sqlmek="update into Student_info set(ID,s_name,l_name,address,pincode,mobile_no,mail_id)values ("; sqlmek
Declare Reference variable
Declare Reference variable   class A { int a; //instance... is shared. I just want to ask if we declare Reference variable above then what does...?? (Generally we used to declare reference variable in main method at the time
How to Print Array in JavaScript
How to Print Array in JavaScript In this section you will learn about Array in JavaScript. Array are important part of all programming languages. Array in JavaScript is a variable that can hold more than one value. Array is a collection
getting variables
getting variables   how to get variables from servlet program to webservice program
Variables in Java
Before using variables you must declare the variables  name and type. See... Variables       Data... declare a variable we need to specify the  type of value it will hold along
Environment variables
Environment variables  How to set Environment Variables in JAVA 6 n Tomcat 6 CLASSPATH, JAVA_HOME, PATH, & CATALINA variables plzzz plzz help me
Variables in Java
Variable in Java In this section you will learn about variables in java. First we should know, what is variable? variable is a location in the memory where... can also declare more than one variable at at time and you can also initialize
Use DECLARE Statement in Procedure
Use DECLARE Statement in Procedure       Use DECLARE Statement in Procedure is used to define... illustrate an example from 'Use Declare Statement in Procedure'. To grasp
Declare Cursors in SQL
Declare Cursors in SQL       Declare Cursors in SQL is used to define cursor and its... 'Declare Cursors in SQL'. To grasp the example, we create a table 'Stu_Table
JavaScript Variables and Data types
 JavaScript Variables and Data types... will learn the basics of JavaScript Variables and Data types. JavaScript Variables.... These names are called variables.  Declaring and Initializing the Variables
How to Declare fflush() Function in PHP
How to Declare fflush() Function in PHP  Hi, Can someone give my any online example for write all the buffered data of an open file. Is it appropriate to use the PHP fflush() Function to develop this application? Please suggest
Use DECLARE Statement in Procedure
Use DECLARE Statement in Procedure       Use DECLARE Statement in Procedure is used... The Tutorial illustrate an example from 'Use Declare Statement
How to use multiple declaration in jsp
;     JSP provide two ways to declare variables or methods: 1: Declare in scriptlet :- The scope of this kind of declaration... will learn how to declare multiple variables and methods in jsp  that prints
Java - Declaring variables in for loops
Java - Declaring variables in for loops  Java - Declaring variables in for loops
instance variables - Java Beginners
instance variables  instance variables
Flex Variables
with it. Variables are used to store values for the application. In flex, var statement is used to declare the variable. var myVar:int; Variable
Variables In Java
This tutorial demonstrates you about the variables and their types in java
 

 

 

DMCA.com