Results: 1021
The third argument of
JSON.stringify(value, replacer, space)
is the number of spaces to use for pretty formatting
let user = {
  name: "John",
  age: 25,
  roles: {
    isAdmin: false,
    isEditor: true
  }
};

document.write('<pre>' + JSON.stringify(user, null, 8) + '</pre>');
It’s fine if we want to send an object over a network. The
space
argument is used exclusively for a nice output. Note: max value of space parameter is
20
The result of the above code:
{
        "name": "John",
        "age": 25,
        "roles": {
                "isAdmin": false,
                "isEditor": true
        }
}
It has 8 spaces for each TAB
HTML forms only support
GET
and
POST
as HTTP request methods. A workaround for this is to tunnel other methods through
POST
by using a
hidden form field
which is read by the server and the request dispatched accordingly
<input type="hidden" name="_method" value="DELETE">
However,
GET
,
POST
,
PUT
and
DELETE
are supported by the implementations of XMLHttpRequest (i.e. AJAX calls) in all the major web browsers (IE, Firefox, Safari, Chrome, Opera)
The symbols: hyphen
-
, under-score
_
and period
.
are allowed in element name. The XML example is valid
<?xml version="1.0" encoding="UTF-8"?>
<student>
   <first-name>George</first-name>
   <phone.mobile>(011) 123-4567</phone.mobile>
   <native_language>English</native_language>
   <city />
</student>
Sub-queries
sub-query
used in
SELECT
clause. Calculates student's point in percent based on max points
SELECT
    id,
    first_name,
    points,
    (
        points * 100 /
        (
            SELECT
                MAX(points)
            FROM
                students
        )
    ) AS percent
FROM
    students
sub-query
used in
IF
conditional statement. Highlights the student with title
Highest
which has highest points
SELECT *, 
    IF(points>=90, IF(points=(SELECT MAX(points) FROM students), "Highest", "Brilliant"), "Lazy") AS class
FROM `students`
ORDER BY points DESC
sub-query
used in
FROM
clause. Select liked notes with likes counts and authors
SELECT 
    students.first_name, 
    note_id, 
    notes.note,
    liked_notes.likes_count
FROM (  
    	SELECT 
            note_likes.note_id AS note_id,
            COUNT(note_likes.id) AS likes_count
        FROM note_likes
        GROUP BY note_likes.note_id
    ) AS `liked_notes`
JOIN notes ON liked_notes.note_id = notes.id
JOIN students ON notes.student_id = students.id
ORDER BY likes_count DESC
sub-query
used in
WHERE
clause. Selects all students that have max points
SELECT
    id,
    first_name,
    points
FROM
    students
WHERE
    points = (
        SELECT
            MAX(points)
        FROM
            students
    )
sub-query
used in
INSERT
statement. Before inserting the record,
sub-query
gets
gender_id
based on the provided gender name
INSERT INTO students (
    first_name, 
    last_name, 
    points,
    gender_id
) 
VALUES (
    'ილია', 
    'დავითაშვილი', 
    '84',
    (SELECT id FROM genders WHERE name = 'Male')
)
sub-query
used in
WHERE
clause in
UPDATE
statement. Updates students table based on notes table column
notes.id
UPDATE 
  students 
SET 
  points = points + 1 
WHERE 
  student_id = (
    SELECT 
      student_id 
    FROM 
      notes 
    WHERE 
      notes.id = 1
  )
An object may provide method toJSON for to-JSON conversion. JSON.stringify automatically calls it if available
let room = {
  number: 23,
  toJSON() {
    return this.number;
  }
};

let meetup = {
  title: "Conference",
  room
};

// document.write(JSON.stringify(room));
document.write(JSON.stringify(meetup));
Result of the code above is the following
{"title":"Conference","room":23}
- An element name can contain any alphanumeric characters. Allowed
symbols
in names are the hyphen
-
, under-score
_
, period
.
and digits
0-9
- Names are
case sensitive
, Address, address, and ADDRESS are different names. - Start and end tags of an element must be
the same
. - An element, which is a container, can contain
text
or
elements
<?xml version="1.0" encoding="UTF-8"?>
<student>
   <first-name>George</first-name>
   <phone.mobile>(011) 123-4567</phone.mobile>
   <native_language>English</native_language>
   <city />
</student>
Note: XML element name must not start with
.
,
-
,
digit
The term
CDATA
means,
Character Data
. CDATA is defined as blocks of text that
are not parsed
by the parser, but are otherwise recognized as markup
<?xml version="1.0" encoding="UTF-8"?>
<student>
    <!-- Some comment about the student -->
    <first-name>George</first-name>
    <phone.mobile>(011) 123-4567</phone.mobile>
    <city />
    <description>
        <![CDATA[
            <p>
            <a href="/mylink/article1"><img style="float: left; margin-right: 5px;" height="80" src="/mylink/image" alt=""/></a>
            Author Names
            <br/><em>Date</em>
            <br/>Paragraph of text describing the article to be displayed</p>
        ]]>        
    </description>
</student>
CDATA Start section
- CDATA begins with the nine-character delimiter
<![CDATA[
CDATA End section
- CDATA section ends with
]]>
delimiter
CData section
- Characters inside
CData
section are interpreted as characters, and not as markup. It may contain markup characters
<
,
>
, and
&
, but they are ignored by the XML processor
1. CDATA is still
part of the document
, while a comment is not 2. In CDATA we cannot include the string
]]>
, while in a comment
--
3. CDATA content is visible on the web if we specify
xmlns
attribute as
http://www.w3.org/1999/xhtml
, even if the file is saved as
.xml
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>CDATA Example</title>
    </head>
    <body>

        <h2>Using a Comment</h2>
        <div id="commentExample">
            <!--
            You won't see this in the document
            and can use reserved characters like
            < > & "
            -->
        </div>

        <h2>Using a CDATA Section</h2>
        <div id="cdataExample">
            <![CDATA[
            You will see this in the document
            and can use reserved characters like
            < > & "
            ]]>
        </div>

    </body>
</html>
1.
CDATA 
cannot contain the string
]]>
anywhere in the XML document 2.
Nesting
is not allowed in CDATA section
live-sass-compiler
extension can generate either
compressed
or
expanded
version of
.css
files. Configuration for
expanded
version:
"liveSassCompile.settings.formats": [
    {
        "format": "expanded",
        "extensionName": ".css",
        "savePath": "/css/"
    }
]
Configuration for
compressed
version:
"liveSassCompile.settings.formats": [
    {
        "format": "compressed",
        "extensionName": ".min.css",
        "savePath": "/dist/css/"
    }
]
Results: 1021