Q1: How to save the state of a variable in order to be able to recreate it when needed?
Summary
- Q: What is Serializing and Deserializing?
- A: Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed. The reverse process is called deserialization.
- Q: What Is Serialization?
- Q: What is serializing and deserializing JSON?
- Keywords: JSON
- Key functions:
JSON.stringify()
andJSON.parse()
- Keywords: JSON to a file
- Basic Examples:
- DVJS11: a JS variable to a JSON string(memory)
- DVJS13: a JSON string(memory) to a JS variable
- Basic Examples:
- DVJS21: a JS variable to a JSON file
- DVJS23: a JSON file to a JS variable
- A Very Basic Example:
- The step M25.DB01 of the DVJS12 :
- At first: A JavaScript variable is transformed into a JSON string(memory) by the DVJS12.
- Secondly: It is formatted by “Prettier - Code formatter v9.5.0” and toggled as a comment in the VScode(Visual Studio Code) by myself.
- At last: It is appended to the note that contains the DVJS12 code by myself.
- The step M25.DB01 of the DVJS12 :
Summary_M25.DB01 of the DVJS12
```JS
// M25.DB01 Debug Output: h_org_keys_to_lower_case
// #####################################################################
//dv.span("The following is the content of the `h_org_keys_to_lower_case`.\n");
//dv.span(JSON.stringify(h_org_keys_to_lower_case, null, 2), "\n");
//The following is the content of the h_org_keys_to_lower_case.
// let h_org_keys_to_lower_case = {
// file: 1,
// date: 2,
// drinks_y: 1,
// drinks_d: 1,
// exercises_a: 1,
// exercises_b: 1,
// "exercises duration": 1,
// expenses: 1,
// remark: 1,
// "exercises-duration": 1,
// };
```
Q2: How to reuse user-defined functions, a DVJS, or a DQL?
Summary
- Q: How to reuse user-defined functions without installing other plugins?
- Q: How to reuse a DVJS?
- Solutions: by Folkemunne
- Q: How to reuse a DQL?
- Solutions: by Craig