images to svg
This commit is contained in:
parent
a31e881856
commit
3ba28aa104
734 changed files with 11682 additions and 245 deletions
|
@ -9,7 +9,7 @@ An object can be created with figure brackets `{…}` with an optional list of *
|
|||
|
||||
We can imagine an object as a cabinet with signed files. Every piece of data is stored in its file by the key. It's easy to find a file by its name or add/remove a file.
|
||||
|
||||

|
||||

|
||||
|
||||
An empty object ("empty cabinet") can be created using one of two syntaxes:
|
||||
|
||||
|
@ -18,7 +18,7 @@ let user = new Object(); // "object constructor" syntax
|
|||
let user = {}; // "object literal" syntax
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
Usually, the figure brackets `{...}` are used. That declaration is called an *object literal*.
|
||||
|
||||
|
@ -42,7 +42,7 @@ In the `user` object, there are two properties:
|
|||
|
||||
The resulting `user` object can be imagined as a cabinet with two signed files labeled "name" and "age".
|
||||
|
||||

|
||||

|
||||
|
||||
We can add, remove and read files from it any time.
|
||||
|
||||
|
@ -60,7 +60,7 @@ The value can be of any type. Let's add a boolean one:
|
|||
user.isAdmin = true;
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
To remove a property, we can use `delete` operator:
|
||||
|
||||
|
@ -68,7 +68,7 @@ To remove a property, we can use `delete` operator:
|
|||
delete user.age;
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
We can also use multiword property names, but then they must be quoted:
|
||||
|
||||
|
@ -80,7 +80,7 @@ let user = {
|
|||
};
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
The last property in the list may end with a comma:
|
||||
|
@ -474,7 +474,7 @@ let phrase = message;
|
|||
|
||||
As a result we have two independent variables, each one is storing the string `"Hello!"`.
|
||||
|
||||

|
||||

|
||||
|
||||
Objects are not like that.
|
||||
|
||||
|
@ -488,7 +488,7 @@ let user = {
|
|||
};
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
Here, the object is stored somewhere in memory. And the variable `user` has a "reference" to it.
|
||||
|
||||
|
@ -506,7 +506,7 @@ let admin = user; // copy the reference
|
|||
|
||||
Now we have two variables, each one with the reference to the same object:
|
||||
|
||||

|
||||

|
||||
|
||||
We can use any variable to access the cabinet and modify its contents:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue