In the previous article we discussed the default parameters in JavaScript, and this article discusses the arguments parameter object for JavaScript.
As a function of the following example, how do we do different processing according to the
Some languages-like ruby,coffeescript and the coming JavaScript version-can declare default parameters when defining a function, as follows:
Copy Code code as follows:
function MyFunc (param1, param2 = "Second string") {
JavaScript Strike method
The Strike method returns a string that uses the strikethrough style defined by the HTML strike Tag property. The syntax is as follows:
Copy Code code as follows:
Str_object.strike ()
Hint: This
JavaScript substring method
The substring method is used to intercept a string by specifying a start and end position and to return an intercept part of the string. The syntax is as follows:
Copy Code code as follows:
Before see NetEase or Sina or what what website again, also use similar this kind of thing, at that time to JS just bucket level, on the spot was scared silly.
But this time, I intend to personally analyze, later in see will not be confused.
Some days ago when the interview used this, the interviewer said I understand a little deviation, back to read the book and some blog, did a bit of testing, found that their understanding is indeed wrong
1. Global variables
It's supposed to be the
We often write callbacks through anonymous functions (Anonymous function).
Simply speaking, anonymity is a function that has no name, and is generally executed immediately. But what about the performance of a named function (a function with a name)?
Creating objects
• Direct volume of objects
var o = {
foo: ' Bar '
}
• constructors
var o = new Object ();
• Prototype inheritance
var p = object.create (o);
Class inheritance
JavaScript objects
1: A way to convert numbers to strings
Copy Code code as follows:
var string_value = string (number);
String_value = Number.tostring ();
var n = 17;binary_string = n.tostring (2); Evaluates to "10001"Octal_string = "0" + n.tostring (8
Word: = = = First convert type and then compare, = = First judge the type, if not the same type directly to False.= = = = = = = = = = = = = = = =
Alert (0 = ""); True
Alert (0 = false);//True
alert ("" = false); True
Alert (0 = =
It was originally intended to be compatible with browsers such as Netscape and FireFox, but these browsers do not support Style.pixelleft, and have to use Style.left and the like (Style.pixelleft is a number without units, Style.left For the text
First, some concepts: 1. The mouse event has a Botton property: Returns an integer that indicates which mouse button was clicked.BUG: In IE and standard DOM mouse events, the only button property value is the same as the "Right-click" event, which
The encapsulated motion frame Move (obj,attr,itarget) can be directly invoked:
Can be used to set the width, border, fontsize, MarginLeft, opacity and many other common property values of variable speed change, to achieve a variety of interesting
I think we are not very deep impression, but I have been in the classics for more than two or three years, I really like here, know the classic people most often hang on the tip of the word is: The classic forum is a place for cattle to stay.
I
The core of the algorithm is the partial matching table and the fallback algorithm, and some matching tables are implemented as follows:
Copy Code code as follows:
function Kmpgetstrpartmatchvalue (str) {
var prefix = [];
var suffix = []
Creating a JavaScript namespace is simply a matter of putting your own functions, objects, variables, and so on in a pseudo namespace, wrapped in an anonymous function.
Copy Code code as follows:
(function () {
function $ (ID) {
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