List of Cache-Related HTTP Header Fields?

(Personally, this answer is totally a mess :rage::rage::rage:, I may rewrite it some day…:disappointed_relieved::sob:)

Read More

Comments

How to get nth fibonacci number in JavaScript?

In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …

By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.

Read More

Comments

What's the difference between let, const and var?

var

Scope

As we all know, there isn’t block-level scope but function-level scope in JavaScript.

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
var scope = 'outer scope'
{
var scope = 'inner scope'
console.log(scope) // inner scope
}
console.log(scope) // inner scope
function foo() {
var scope = 'function scope';
console.log(scope) // function scope
}
foo()
console.log(scope) // inner scope

Read More

Comments

What are multipart/form-data and application/x-www-form-urlencoded?

Both of them are the optional values of enctype where the <form> element specifies the content type used to encode the form data set for submission to the server. There are three choices:

  1. application/x-www-form-urlencoded (default)
  2. multipart/form-data
  3. text/plain

Read More

Comments

Differences between cookie, session and Web Storage?

HTTP is a stateless protocol, but there are many situations where we need to get stateful infomation…Cookies were designed for this to be a reliable mechanism for websibites to remember stateful information.

A cookie is a small piece of data sent from a website and stored in the user’s web browser while the user is browsing.

Read More

Comments

What's the difference between async and defer?

The async and defer are boolean attributes introduced in HTML5 of <script>.

Behavior

neither

1
<script type="text/javascript" src="where.js"></script>

Once the HTML parser meets a <script>, the parser will stop parsing HTML and send a request to get the file (if it’s external). Then, the JavaScript engine will execute the script. After the script’s execution finished, the parser will continue parsing the HTML.

Read More

Comments