This is the 23rd day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

Preface:

In the previous series of articles, we have studied some knowledge points of JavaScript, but also through THE JS implementation of classical algorithms for specific learning, summary more reading -list & classic sorting algorithm -list

So let’s move on to another technique in JS :JSON

JavaScript object Representation – (JSON)

For JSON we see a lot, most of the data returned by the request back end during project development is in JSON format.

MDN | (JSON) is used to structured data are expressed as the standard format of JavaScript object, is often used to said on the website and transmit data (for example from the server to the client to send some data, so it can be displayed on the web page

What is a JSON

JSON is a data format that follows JavaScript object syntax

But the back end also uses jSON-formatted (.json) data, so JSON, while it is based on JavaScript syntax, is independent of JavaScript and can be used in many environments.

JSON data structure

You can write JavaScript objects to JSON data as they are: strings, numbers, arrays, booleans, and other literal objects:

The object tree

For example, some data is returned by the back-end request of the page query:

{
  "data": {
    "category_id": "6809637767543259144"."category_name": "Front end"."category_url": "frontend"."rank": 2."back_ground": "https://lc-mhke0kuv.cn-n1.lcfile.com/8c95587526f346c0.png"."icon": "https://lc-mhke0kuv.cn-n1.lcfile.com/1c40f5eaba561e32.png"."ctime": 1457483942."mtime": 1432503190."show_type": 3."item_type": 2."promote_tag_cap": 4."promote_priority": 2}}Copy the code

JSON array

Array objects are also valid JSON objects, such as the data returned by a more detailed article request: “whitelist_urls”, “blacklist_urls”

{
  "jserr": {
    "whitelist_urls": [{"name": "default"."create_by": "system"."create_time": 1610093400."update_by": ""."update_time": 0."condition": {
          "field": ""."op": ""."values": []."is_default": true
        },
        "priority": 1."value": "[]"."setting_type": "string_array"."setting_op": "like"}]."blacklist_urls": [{"name": "default"."create_by": "system"."create_time": 1610093400."update_by": ""."update_time": 0."condition": {
          "field": ""."op": ""."values": []."is_default": true
        },
        "priority": 1."value": "[]"."setting_type": "string_array"."setting_op": "like"}}}]Copy the code

Read more:

Classical sorting algorithm:

  • 【 jS-sort algorithm -sort()】,
  • 【JavaScript- sort algorithm – Hill sort 】
  • 【JS- sorting algorithm – merge sort 】,
  • 【JavaScript- sorting algorithm – counting sort 】
  • 【JS- sort algorithm – bubble sort 】
  • JS- Classical sorting algorithm – Selection sort,
  • 【JS implementation – classical sorting algorithm – insert sort 】
  • JS implementation – classical sorting algorithm -JS implementation of radixSort (radixSort)
  • Learn the classic sort algorithm -JS to implement quickSort
  • Learn sorting algorithm skills – three – way fast sorting

JavaScript learning and Improvement

  • 】 【 Array. The prototype. The map (),
  • JS- special symbol – bit operator
  • 【ES6 – for/of】,
  • JS- Logical operator – short circuit? ,
  • 【JS- arrow function 】
  • 】 【 JavaScript – forEach (),