MainMenu

Home Java Overview Maven Tutorials

Sunday, 3 November 2024

Java Script Tutorial 2 Variables in Java Script




Variables in JavaScript

1) Variable names are case sensitive means “way2testing” and “WAY2TESTING” are different.

2) Space is not allowed only letter, digit, underscore and $ is allowed in variable name.

3) Reserved words cannot be used as variable name like “log, break, case, catch etc”.

4) Variable name’s first character must be only a letter, underscore or $.

Note : In general variable name should be in camel case.

Variable name can be used with three keywords

var : Variable can be re-declared and updated. A global Scope variable.
let : Variable can’t be re-declared but can be updated. A block scope variable.
Const: Variable can’t be re-declared or updated. A block space variable.

Note : const variable generally defined in capital letter.





No comments:

Post a Comment