JavaScript data type
1.Boolean (Boolean)
Boolean: (value type) var b1=true;//boolean type
2.Number (digital)
Numeric value: (value type) var n1=3.1415926;//numeric type
N1.tofixed (3);//rounded to keep 3 decimal digits.
3.String (String)
The concept of two-fork tree
A binary tree (Binary) is a finite set of n (n>=0) nodes, the collection is either an empty set (a null binary tree) or a two-forked tree of a root node and two disjoint Saozi, called root nodes, respectively.
The
The New Year holiday, also finally idle down. It's a great state to visit every day in a variety of technical articles.
In the afternoon read the article about JS, which has the following such a paragraph caught my attention.
Copy Code code
First, naming
1, should give variables and functions to take a precise name, do not arbitrarily named.
2, the constructor uses the hump naming method, uses the movable object structure as far as possible, distinguishes with the variable name, like
Data type:1. Numeric type (integer int floating-point type floating)
2. String type
3. Boolean (Only two values: Ture fasle)
literal number of strings
1. Escape series:
Some symbols in JavaScript are not recognizable, and are only shown correctly
Copy Code code as follows:
/*
JS Basic Grammar, a few more easily confusing place.
*/
/*
==
===
*/
Function de () {
var ab = 25; Numerical
var ba = "25"; String
if (ab = = ba) {//==, will be converted first, after the pair.
Alert
Regardless of the coding style, design pattern, etc., the coding style is generally focused on the writing specification, while the design pattern is biased toward the program architecture design. These "patterns" in this article include some common
1, the creation of the function
Since I have used a lot of functions before, I am not here to share more.
2. Nested functions
Copy Code code as follows:
function of the ()
{
function people ()//nested functions, only the
{
The code in Build.js calls the Uglifyjs interface function to perform the compression task.
1, go to GitHub to download the latest UGLIFYJS. Two ways to download, if Git is installed, go to git console and use the following command
git clone
1. Identifiers and Keywords
Identifiers begin with a letter and can contain letters, numbers, and underscores. Identifiers cannot use the following reserved characters:
Copy Code code as follows:
Abstract, Boolean,
A summary of the attributes, methods, and events of window.document in JavaScript, a friend in need can refer to this article.Properties:Attributes a list of properties for storage nodes (read-only)ChildNodes List of child nodes for storage nodes
1.URI method
encodeURI () and encodeURIComponent () encode the URI
encodeURI () does not encode special characters that are part of the URI, such as colons, forward slashes, greetings, well words, etc.
encodeURIComponent () encodes any non-standard
1. Create Date objects
Copy Code code as follows:
var now = new Date (); Get current system date and time
var somedate = new Date (Date.parse ("may 25,2012"));
var somedate = new Date ("may 25,2012"); Same as on
var somedate =
Use the OnError event of an Image object to determine that an error replaces the URL of the image object's SRC as the default picture.
first case: Picture exists, normal display second case: Picture does not exist, show default picture
Four ways to go heavy with Javascript arrays
Four algorithms to achieve this goal:
The first method:
Array.prototype.unique1 = function () {
var n = [];//A new temporary array for
(var i = 0; i {
//If Part I of the current array has
A circular upward scrolling text, such as the scrolling effect above
Second, the realization of the idea
1, the establishment of three layers Dome, dome1, dome22, vertical scrolling text on the dome13, through the layer of scrolling to achieve
The Window:window object is the core of all objects in the BOM, and includes some window control functions in addition to the parent object of all objects in the BOM.
1, the Global Window object
Any global function or variable in JavaScript is a
Default Object
Date Object,
Format: Date Object name =new date ([date parameter])
Date Parameters:
1. Ellipsis (most commonly used);
2. English-numeric format: month, year [Time: minutes: sec]
such as: Today=new Date ("October 1,2008 12:00:00")
JavaScript is a scripting language designed to interact with Web pages, and its composition
ECMAScript (CORE) DOM (Document Object model) BOM (Browser object model)
1.1ECMAScript
The ECMA-262 definition of Ecmascrip is not dependent on the Web
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.