Prototype: APIs written in Javascript, including extensions of Javascript classes such as String and Array, after embedding a JS file, you can directly use prototype. It is an API written in Javascript, including the expansion of Javascript classes
This article mainly introduces five typical JavaScript interview questions, which may appear in javascript interviews of various companies. For more information, see
1: Scope
The Code is as follows:
(Function (){Var a = B = 5;})();Console. log (B
Use of Regular Expressions in Javascript and basic syntax,
Previous
Regular expressions may be a bunch of incomprehensible characters in people's minds, but these symbols implement efficient string operations. Generally, the problem is not
/*
-------------- Function retrieval --------------Trim function: trim () lTrim () rTrim ()Check whether the string is null: checkIsNotEmpty (str)Check whether the string is an integer: checkIsInteger (str)Minimum integer verification value:
/*
-------------- Function retrieval --------------Trim function: trim () ltrim () rtrim ()Check whether the string is null: checkisnotempty (STR)Check whether the string is an integer: checkisinteger (STR)Minimum integer verification value:
JavaScript to determine whether the prefix or suffix is a space, and javascript prefix
This example describes how to use JavaScript to determine whether a prefix or suffix is a space. Share it with you for your reference. The details are as follows:
/** Created by yzh 2003.5.12* Common JS test functions* Keep this author statement when you reference it. This code is open source code and is unrestricted. You are welcome to use the JavaScript code to dynamically drag the table to implement the
1. An array defines an array. vararr1newArray () or vararr2 [] is not required in either of the two methods. Obviously, it is convenient to define an array for the second time. Define the array and initialize it. You can directly use vararr3 [& quot;
JavaScript code will surely be used as a space. In the next article, we will introduce in detail how to remove spaces on the left and right sides of the string respectively, if you are interested, you can refer to the following strings to separate
Prototype source code analysis String section (1) about indexOf optimization. For more information, see. There are many methods added to String. prototype, but they are roughly divided into the following categories:
Category
Method Name
There are many methods, for example:
First: (use the charcodeat method of the string object)
String. prototype. getbyteslength = function () { var length = 0; for (I = 0; I icode = This. charcodeat (I); If (icode> = 0 & icode = 0xff61 & icode
Here we use a regular expression to delete the object. There are other methods on the Internet. If you are interested, you can check them yourself.
Added the delete function
Code As follows:
Code highlighting produced by Actipro CodeHighlighter
Dozens of web design skills
1. oncontextmenu = "window. event. returnvalue = false" will completely block the right mouse button NO
2. cancel selection to prevent Replication
3. onpaste = "Return false" Do not paste
4. oncopy = "Return false;"
JavaScript -- add the trim, ltrim, and rtrim methods to the String object in JavascriptUsing the prototype attribute of each Object in Javascript, we can add our own method to the built-in objects in Javascript.
And attributes. Here we will use
Describes how to use the JS Regular Expression replace and the jsreplace
Before talking about the advanced application of replace, let's sort out several important knowledge points in JS regular expressions to help you review your basic knowledge,
109. Change the status bar self. Status = "";//
110. Change the window size window. resizeTo (200,300 );//
111. Change the mouse style body {cursor: URL ('mouse. Ani '); SCROLLBAR-BASE-COLOR: #506aa8; SCROLLBAR-ARROW-COLOR: # 14213f ;}//
112.
CopyCode The Code is as follows: # flower {
Width: 100px;
Font-size: 12px;
Float: left;
Opacity: 0.5;
Filter: alpha (opacity = 50 );
}
Define a div element with ID = "Flower" and set the above style. Our goal is to get the final attribute of the
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.