Recently made a JavaScript to display the next day's date case now the function code is published
Date.prototype.pattern=function (FMT) {var o = {"m+": This.getmonth () +1,//month "d+": th Is.getdate (),//day "h+": this.gethours ()%12 = = 0?
In JavaScript, we may rarely use a label statement, but it is a good practice to apply a label statement, especially in a nested loop, where the continue and label can be accurately returned to the location of the program you want. Label statements,
Dom object: A DOM element object obtained by the traditional JS method; jquery object: A new object generated after wrapping the original DOM object through the jquery method.
$ (function () {
//***** Dom object converted to
bootstrap use JavaScript to display a modal box to move the page up
Solution:
Add data-toggle= "modal". Although this property modal box will still pop up, but if the page has a scroll bar in the vertical direction, the page will move up.
Duck-type discrimination method to implement JavaScript interface:
Ya Shi Bian Li method to implement interface//interface inspection, to be able to verify the implementation of an interface, and interface all the methods//Definition interface
First write the HTML structure:
Home
Products
Address
About
Contact
Then simply write the style:
body{font-family: "Microsoft Ya-hei";
active{
background:-webkit-linear-gradient
object-oriented and object-based
Almost every developer has development experience in object-oriented languages such as C + +, C #, Java. In traditional object-oriented languages, there are two very important concepts-classes and instances. A class
On the internet to see a face test, as follows:
Write alert (1&&2), Alert (1| | 0) output results.
alert (1&&2); 2
alert (1| | 0); 1
Output results 2 and 1.
Knowledge Points:
&& operator rule: a&&b, if A is true, returns B directly, or returns
Something in [] inside the function means dispensable.
Function
Custom functions
function declaration:
function name ([argument list]) {
function body;
[Return value];
}
(both the argument list and the return value are optional)
Call to
Way 1,splice
var ary = [1,2,3,4];
Ary.splice (0,ary.length);
Console.log (ary); The output [], an empty array, is emptied
Method 2,length assignment to 0
Other languages such as Java, whose array length is read-only, cannot be assigned a value.
4.5 Invocation Expression
The invocation expression of JavaScript is a syntax representation of a function or method called (or executed). It starts with a function expression that refers to the function to invoke. A function
All four methods need to use a temporary array and eventually return the temporary array.
(i) Use method indexof to determine whether the current element already exists in a temporary array, or push to a temporary array if it does not exist (the
Overview
Since the executive function is also called the call function immediately, as the name implies, can be executed immediately after the function declaration, we read the common JS library (such as jquery) source code, often found from the
Brief Introduction
JavaScript Secret Garden is a constantly updated document that focuses on some of the quirky uses of JavaScript. Beginners can learn more about the language features of JavaScript by giving advice on how to avoid common bugs,
require.js:
Requirejs is a very compact JavaScript module loading framework, one of the best implementations of the AMD (asynchronous module Definition, asynchronous modular loading mechanism) specification. The latest version of the Requirejs
Multi-line annotations are used:/* * * */{} After Conditional control statement can improve code readability and error when modifying codeLine breaks and variable indentation in the codeAn if conditional expression is best used in the form of a
Jsonp involved in the same-origin strategy, cross-domain and other issues, here is not elaborate.The implementation is to create a dynamic script tag to request a background address:Example:function (res) { Console.log (res)
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.