Copy Code code as follows:
/**
* An extension to date that converts date to a string of the specified format
* Month (M), Day (d), 12 hours (h), 24 hours (h), minutes (m), seconds (s), Week (E), quarter (q) can be 1-2 placeholders
* Year (Y)
As you know, there are two ways to iterate objects in javascript:
(1) for loop;
(2) for. in circulation;
Using a For loop to iterate over a group of objects must have been commonplace. However, use for.. In the cycle, we should pay attention to, why
There are four semantic functions of the curly braces in JS
Semantic 1, organizing compound statements, which is the most common
Copy Code code as follows:
if (condition) {
//...
}else {
//...
}
for () {
//...
}
Here are some of the more commonly used regular expressions I've collected, because it's usually possible to use more of the form validation. Special sends out, lets each friend use together. Oh.
Matching regular expressions for Chinese characters:
Public processing timestamp function
Copy Code code as follows:
/**
* Process timestamp converted to date format
* @param {Object} obj timestamp {10-bit timestamp needs to be multiplied by 1000; 13-bit timestamp does not need}
*
Where do I put the JavaScript code?
Typically, JavaScript code is used with HTML code, and JavaScript code can be placed anywhere in an HTML document. However, the place will have a certain effect on the normal execution of JavaScript code, as
This paper discusses the difference between the variable declaration in JavaScript and VAR, and the scope of the variable declaration in JS is in function, so we often see that the method of avoiding the global variable pollution is
I always encounter situations where it is necessary to check whether a function is native--a very important part of the functional test: The function is supported by the browser, or is modeled by a Third-party class library. The easiest way to
The examples in this article illustrate the usefulness of JavaScript to avoid memory leaks and memory management techniques. Share for everyone to use for reference. The specific methods are as follows:
This article originates from Google Webperf
Feature Description: Open a Web page, after 5 minutes without action, will lock the page, hide the content container, display a container to enter the password, enter the correct password to unlock. When locked, even if the user refreshes the page,
Abstract Factory mode Description
1. The problem of the factory method pattern: In the factory method pattern, the creation class all needs to go through the factory class, if wants to extend the program, must modify the factory class, this
As with most programming languages, there is a Boolean type in JavaScript that is used logically for judgment. However, unlike many other programming languages, the concept of truthy values and Falsy values exists in JavaScript-all types of
How to capture and analyze JavaScript Error
Front-end engineers know that JavaScript has basic exception handling capabilities. We can throw the new error () and the browser throws an exception when we invoke the API error. But it is estimated that
Array Categories:
1, from the array of subscript divided into index array, associative array
Copy Code code as follows:
/* Index array, that is, an array that is usually called/
var ary1 = [1,3,5,8];
Array elements by index,
1.slice ();
Both array and string objects have
Slice in Array (I,[j])
I is the index value that starts the interception, and the negative number represents the index value from the end, minus 1 is the first element.J is the ending index value,
Almost 20 years ago, when JavaScript was born, it was just a simple web scripting language. If you forget to fill in the username, it jumps out a warning.
Today, it becomes almost omnipotent, from the front end to the back end, with a variety of
Inheritance in JavaScript is accomplished through a prototype chain (prototype chain): There is another object inside each object that exists as its prototype, and the object inherits the property from the prototype. For each object, you can access
JavaScript Cookies
Cookie object:A cookie is a user data information (cookie data) that is stored as a file in a cookie folder on the client's hard disk.The cookie file is established by the Web site visited to hold the session data between the
The ubiquitous callback in JavaScript is a disaster for process control, and the drawbacks are obvious:
1. No explicit return, easy to generate redundant processes, and the resulting bug.2. Cause code Unlimited nesting, difficult to read.
Here is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service