📖 Samacheer Kalvi · 11th TN - English Medium · Computer Applications · Page 300question

CHAPTER 14 · Part 3

Chapter 8: CHAPTER 14 · Computer Applications

be as the first Chapter Pages character. . The rest of the variable name can include any letter, any number, or the underscore. You can't use any other characters, including spaces, symbols, and punctuation marks.

. JavaScript variable names are case sensitive. That is, a variable named RegisterNumber is treated as an entirely different variable than one named registernumber. .

There is no limit to the length of the variable name. . JavaScript's reserved words cannot be used as a variable name. All programming languages have a supply of words that are used internally by the language and that cannot be used for variable names.

. . Scope of variables The scope of a variable is the life time of a variable of source code in which it is defined. • A global variable has global scope; it can be defined everywhere in the JavaScript code.

• Variables declared within a function are defined only within the body of the function. They are local variables and have local scope. . .

Assigning values to variables Variables can be assigned initial values when they are declared as follows: var numericData1 = ; var stringData = "JavaScript has strings\n It sure does"; var numericData = . ; var booleanData = true; <Html> <Head> <Title>Demo Program - Declaring Variables in JavaScript </Title> </Head> <Body> <script language="javascript" type="text/javascript"> var numericData1 = ; var stringData = " JavaScript has strings\n It sure does"; var numericData = . ; var booleanData = true; document.write("Numeric Data : "+numericData1); document.write("<br> String Data : "+stringData); document.write("<br> Floating Data : "+numericData); </script> </Body> </Html> Illustration . Declaring Variables Chapter Pages Output In addition, multiple variables can be declared with one var statement, if the variables are separated by commas: var no1= , no2= ; JavaScript allows the implicit declaration of variables by using them on the left-hand side of an assignment.

In JavaScript there is no need to indicate data type during variable declarations. JavaScript variables are untyped and it is dynamically datatyped which means initially you can assign a value of

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →