The new Array () [] [] represents the array
The new object () {} {} represents the object
JavaScript Objects
Objects are separated by curly braces. Inside the parentheses, the properties of the object are defined in the form of name and value pairs (name:value). Attributes are separated by commas:
var person={firstname: "Bill", LastName: "Gates", id:5566};
The object (person) in the example above has three attributes: FirstName, LastName, and ID.
Spaces and lines do not matter. Declarations can span multiple lines:
var person={firstname: "Bill", LastName : "Gates", id : 5566};
Object properties are addressed in two ways:
name=person.lastname;name=person["LastName"];
Undefined and Null
Undefined This value indicates that the variable does not contain a value.
You can empty the variable by setting its value to null
Local Variables
A variable declared inside a JavaScript function (using VAR) is a local variable that can only be accessed inside the function. (The scope of the variable is local).
You can use a local variable with the same name in a different function, because only a function that declares the variable will recognize it.
As soon as the function is complete, the local variable is deleted.
Global Variables
Variables declared outside of a function are global variables, and all scripts and functions on a Web page can access it.
the lifetime of a JavaScript variable
The lifetime of JavaScript variables begins at the time they are declared.
Local variables are deleted after the function is run. Global variables are deleted after the page is closed.
Assigning a value to an undeclared JavaScript variable
If you assign a value to a variable that has not been declared, the variable is automatically declared as a global variable.
This statement: carname= "Volvo";
A global variable is declared carname, even if it executes within the function.
= = = (value and type) x===5 to true;x=== "5" is false
Triggering an instance through an event
<! DOCTYPE html>function mOver (obj) {obj.innerhtml= "Thank You"} function mout (obj) {obj.innerhtml= "Move mouse over"}</script></body>
JS Learning Summary