"Query and Settings for JS object Properties"
You can get the value of a property by using the dot (.) or square brackets ([]) operator. The left side of the operator should be an expression that returns an object. For dots (.) , the right side must be a simple identifier named after the property name. for square brackets ([]), the square brackets must be an expression that evaluates to a string, which is the name of the attribute:
<script type= "Text/javascript" >
var author = book.author;//Get book's "author" attribute
var name = Author.subname; Get author's "surname" attribute
var title = book["Main title"]//Get book's "Main title" Property
</script>
When passing through the dot operator (.) Method object property, the property name is represented by an identifier. Identifiers must appear directly in the JS program, they are not data types, so the program cannot modify them.
In turn, property names are represented by strings when the properties of an object are passed through []. Strings are data types of JS, which can be modified and created when the program runs.
<script type= "Text/javascript" >
var addr = "";
for (i=0;i<4;i++) {
addr + = cutomer["Address" + i] + "\ n";
}
</script>
This code reads the ADDRESS0,ADDDRESS1,ADDRESS2,ADDDRESS3 properties of the customer object and joins them.
The above is a small series for everyone to talk about the JS object properties through the point (.) and square brackets ([]) of the different parts of the whole, I hope that we support the cloud-Habitat Community ~