This is the 20th day of my participation in the August More Text Challenge
Persistence in learning, notes is the soul, review the old to learn new, from time to time, review the knowledge point, deepen memory, get twice the result with half the effort!
We’ve seen node.js in action: the file system module combined with the HTTP module – building a simple local file server.
By reading the local file, simulating the data interface, by fetching the local. Json file and returning data, is the most used data structure of the front and back end communication: JSON
A lot of the time when you’re doing data manipulation, you’re also dealing with array objects
Next you’ll look at some of the structures/methods that JavaScript deals with a lot, the basic data structures: objects and arrays
Object the Object
Objects allow us to wrap groups of values (as well as other objects) to facilitate the construction of complex data structures
For example, we can use an array to represent a list of daily exercise items. But entries don’t just contain numbers or strings — each entry needs to store a list of activities and a Boolean value indicating whether or not they’re moving.
Ideally, we want to put these groups together into a single value, and then put the values of these groups into an array of log entries.
The value of a type object is an arbitrary collection of properties.
Create an object
One way to create an object is to use curly braces as expressions.
let day1 = {
flag: false.exercise: ["running"."study"."eat"."exercise"]};console.log(day1.flag); / / to false
console.log(day1.flag1);/ / and undefined
day1.flag1 = false;
console.log(day1.flag1);/ / to false
Copy the code
Inside curly braces, there is a comma-separated list of attributes. Each attribute has a name followed by a colon and a value.
When an object is written on more than one line, indent it as in the example to improve readability. Attribute names that are not valid binding names or significant numbers must be enclosed in quotation marks,
For the second property of the following object, if there is a space in the property name, enclose it in quotes
let work = {
work: 'Went to work'.'coded codes': 'Coded codes',}Copy the code
This means that braces have two meanings in JavaScript:
- At the beginning of a statement, they are used to start a block of statements.
- In any other place, they describe an object. Fortunately, curly braces are rarely used to start a statement that uses objects, so ambiguity between the two is not much of a problem
Returns undefined if a property is read that does not exist
Attribute expressions can be assigned using the = operator. If the attribute already exists, it replaces the value of the attribute, if not, the corresponding attribute is automatically created on the object
Read more
Read more articles please check:
Day19 — Learn more about JSON,
Day18 file system server – analog interface,
[Node.js] day16-file system module, [Node.js] day17-HTTP module,
【Node.js】 Efficiency tools – NVM & NRM, etc.
Node.js package management tool NPM & YARN
[node.js] Installation & documentation,
【Github】 Multiplayer collaboration (2), 【Github】 Basic use (1),
【Git】 code version control – Basic Operation (1)
[Node.js] Build automation development environment – Basic introduction, [Tool preparation], [Start], [Detailed steps (4)], [module processing tools (5)], [Understanding of modular programming]
Keep up the pace, step by step! Updates below:
Next will continue to learn JavaScript related methods in detail, chong Duck!! xdm
Learn the efficiency tools to improve development efficiency and empower our development!
Keep up the pace and keep moving forward
Come on!! go~~