Tag JavaScript

JavaScript let and var keywords

ES6 adds the let keyword, which differs from the var keyword as follows. variables declared by let are valid only within their code block. variables declared by var are valid globally. variables declared by var can be used before they…

Encapsulate Ajax functions

1. The effect to be achieved 2. Define options parameter options The itheima() function is our custom Ajax function. It receives a configuration object as a parameter. The following attributes can be configured in the configuration object. method request type…

Encapsulate your own Ajax function

1. The effect to be achieved 2. Define options parameter options The myAjax() function is our custom Ajax function, it receives a configuration object as a parameter, and the following properties can be configured in the configuration object. method request…

In-depth understanding of Document

In the front-end development, some operations must be performed on the DOM more or less, such as some of our commonly used methods: document.getElementById(“”); document.querySelectorAll(“”); document.getElementsByClassName(); document.createElement(). ….. Wait for a series of methods, where do these methods come from?…

In-depth comparison of TypeScript VS JavaScript

TypeScript and JavaScript are currently two popular scripting languages in project development. We are already familiar with TypeScript as a superset of JavaScript, but what is the difference between TypeScript and JavaScript? When choosing a development language, how should one…

Monitoring page shows hidden API

Many times we have such a requirement to do some operations or prohibit some operations when the page is not displayed. The Page Visibility API provides convenience for us to achieve this requirement. The API relies on the document object,…