Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow client-side script to interact with the user and make dynamic pages. It is an interpreted programming language with object-oriented capabilities.
Advantage
- Less server interaction
- Immediate feedback to the visitors
- Increased interactivity
- Richer interfaces
Data Types
JavaScript allows you to work with three primitive data types,
- Numbers, eg. 123, 120.50 etc.
- Strings of text e.g. "This text string" etc.
- Boolean e.g. true or false
Variables
Variables are declared with the var keyword as follows. JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type.
var name = "Ali";
var money;
money = 2000.50;
JavaScript Variable Scope
The scope of a variable is the region of your program in which it is defined. JavaScript variables have only two scopes.
Global Variables − A global variable has global scope which means it can be defined anywhere in your JavaScript code.
Local Variables − A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.
Top comments (1)
Congrats @dharchini