We are generally in accordance with the order of random touch of the cards from small to large order in the hands of neat (remember as a child card two players can not grasp it), this essay is to realize this function to familiarize with the next JS
Posted in Google Webperf (London webperf Group), August 26, 2014.
Efficient JavaScript Web applications must be smooth and fast. Any application that interacts with the user needs to consider how to make sure that memory is used efficiently,
HTML5 supports APIs such as Web worker, allowing Web pages to execute multithreaded code in a secure environment. However, web worker is actually a lot of restrictions, because it can not really share the memory data, only through the message to do
With the development of new technology, JavaScript is no longer just a network language. Now we can see a lot of mobile phones that use JavaScript to build Web applications based on local browsers, as well as a lot of flexible web applications like
1. Design Source
Copy Code code as follows:
javascript Get Path
2. Design result
(1) When initializing
(2) Get the current URL
(3) Get the directory after the host address
(4)
Event triggers can be interpreted literally to trigger events, but some friends who are not used may be confused, and are events not usually triggered by the user's actual actions on the page? This is not entirely true because some events must be
1, native JavaScript implementation string length intercept
Copy Code code as follows:
function Cutstr (str, len) {
var temp;
var icount = 0;
var patrn =/[^\x00-\xff]/;
var Strre = "";
for (var i = 0; i if (Icount temp = Str.substr
Today, while doing an old project, I encountered a requirement to encrypt the parameters in the URL in JavaScript, and found this useful code from the Internet:
Copy Code code as follows:
Later encountered encryption and
Written interview often involves a variety of algorithms, this article briefly introduces some commonly used algorithms, and JavaScript implementation.
First, insert sort
1) Introduction to the algorithm
The algorithm description of insertion
Most recent pages need to load a few Drop-down list boxes for users to choose from, the original is on the server side of the load should be used. Finally, due to business logic considerations, it is necessary to put some of the functions of
When you use JavaScript to display messages or pass character data, you often encounter single quotes (') or double quotes (") in the data, which often cause JavaScript to complain. The general adoption/' or/' solution.
For example:
Alert ('
Reading this article requires programming experience in other languages.
The simple types in JavaScript include:
1. Digital2. String3. Boolean (True and False)4.null5.undefined
Other types are objects (we should not be fooled by the return value
There are two ways to judge integers: regular judgments and literal judgments.
Because the verbatim judgment efficiency is too low, here is not described, interested spectators can own Google.
1. Regular judgment
Copy Code code as follows:
Decorator Mode description
Description: A class to dynamic to another class of functional objects before or after the modification, to add some additional functions; This is the decoration of the function of a class object, the decorated class
Then the problem comes, this page first involves the mobile Web front-end development, I preferred to use the html5+bootstrap combination to achieve the beautiful effect of the page, the front-end other tasks to the JavaScript solution (here I was
Here are 5 small scripts that help you really understand the JavaScript core-closures and scopes. Before the console runs, try to answer what pops up in each case, and then you can create a test file to check your answers. Are you ready?
1,
This article, mainly popularize the usage of promise.
All along, JavaScript processing asynchronous is in the callback way, in the front-end development field callback mechanism almost popular. When designing APIs, both the browser manufacturer and
In the project need a timer, the effect is as follows:
JS Code:
Copy Code code as follows:
/* Get current time * *
function Getcurrentdate ()
{
var timestr = ';
var curdate = new Date ();
var curmonth = Curdate.getmonth () +1;
Usually we judge JS image size is the use of images objects, and then use attr to get the image address to judge on it, below to see some examples.The simplest way:
Copy Code code as follows:
var img=new Image ();
img.src=$ ('
For students who like to write technical blogs, it must be very familiar with the code highlighting component. A good JavaScript code highlighting plug-in will help you render any programming language, including the coloring of some keywords, as
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.