Notes of a high-end programming javascript basic

2010-12-01  来源:本站原创  分类:Web  人气:103 

One. JavaScript
JavaScript is a client-side scripting language, originally intended to carry out the client form data validation consists of three parts
ECMAScript javascript core, describes the syntax and basic object javascript
DOM describes the method of operation of page content
BOM describes the method of operation of the browser
ECMAScript, DOM have been standardized
BOM is not standardized, each browser has a different implementation, such as the Navigator object, Location objects, Screen object, support for cookies

Second ECMASccipt
1. Syntax
a. identifiers, variables are case-sensitive
b. the type of variable is weak, you can change at any time type of the variable
c. end of statement ";" semicolon is optional, the default behavior for the end of statement
d. single line comment / / multi-line comment / * * /
e. braces "{}" indicates a code block

2. Variables
a. line can declare multiple variables var a = '1 ', b = 2
b. variable declaration can not directly use, such as c = 3 is valid, when the interpreter will automatically see when c declare a global variable, note the global variables, and to execute this statement will be declared.

3. The basic types, reference value, and java is similar in basic types stored in the stack, put the value of the reference value of the stack is put the memory address of the object, the object stored in the heap in
ECMAScript provides basic types: undefined, null, boolean, string, number
Each type has it that the basic scope of the text alternative (literal representations)
Using the typeof operator to test object type
The return values typeof string, number, undefined, boolean, object, function
a.undefined
An unassigned variable is undefined such as var a; alert (a)
For the variables, two kinds of cases is undefined, one is declared without an assignment, the other is the variable does not exist there is no return value for function, for his return if the value is undefined
b.null
A derivative is undefined null null == undefined return true undefined is not assigned to a variable declared, null point is the object of this variable is null
c.number
Figures include integer, floating point, 10-band and 16 band.
Infinitely large, infinitely small is NaN
Note that NaN == NaN returns false to determine whether a variable is a number, use isNaN to judge

4. Type Conversion
a. converted to string using toString () method. For the number, you can use the toString (2,8,10,16) into the corresponding 2-band, 8 octal, 10 decimal, 16 hex said, toString () default 10 decimal
converted to number 2 b. One way parseInt ("") and parseFloat (""), the two methods only when the string parameter is passed only effective, otherwise it returns NaN
For parseInt ("") and parseFloat ("") are from the incoming character string 0 start checking if the return is not a number, if the figures have continued testing, has been detected to an illegal character character then the conversion, so
parseInt ("123a") and parseFloat ("123.4a") will return 123 and 123.4
The difference is, parseInt can specify the hex string to be converted, and parseFloat not
c. using the Boolean (arg) Number (arg) String (arg) for the corresponding conversion
Boolean (arg) non-0 number of non-empty string (length> 0) non-empty object return true; others have returned false
Number (arg) with parseInt and parseFloat different, Number detects the entire string, and then decided to use parseInt or parseFloat, Number (true) = 1 Number (false) = 0, the corresponding figure number to return, otherwise return NaN
String (arg) arg directly call the toString () method, except that, for the null, String (null) return "null", null.toString () error, undefined as

相关文章
  • Notes of a high-end programming javascript basic 2010-12-01

    One. JavaScript JavaScript is a client-side scripting language, originally intended to carry out the client form data validation consists of three parts ECMAScript javascript core, describes the syntax and basic object javascript DOM describes the me

  • Advanced programming javascript 2011-01-13

    Advanced programming javascript

  • Three high-end programming javascript object-oriented terminology notes 2010-12-02

    1. Four object-oriented features: encapsulation, aggregation, inheritance, polymorphism 2.javscript have garbage collector, the gc a similar role and java 3.early binding and late binding early binding, bound object at compile time to the properties

  • Advanced Programming javascript Reading Notes (b) 2009-03-02

    1: Dynamic prototype method: function Car (iDoors) ( this.door = siDoors; if (typeof Car._initialized == "undefined") ( Car.prototype.showColor = function () (alert (this.color)); ) )

  • javascript basic grammar 2010-05-01

    1. Do not declare a variable can not be used, otherwise an error: "undefined." Declare the variable can be used: var <variable "[=" value "]; 2. Functions JavaScript scripting language JavaScript procedures constitute a basic c

  • Effective Java 2 study notes in Chapter 8 General Programming 2010-04-21

    Article 45: The scope of local variables to minimize The scope of local variables to make the smallest, the most effective way is to use it in the first place to declare Almost every local variable declaration is an initialization expression should b

  • javascript basic object-oriented technology (Friday) 2009-03-11

    Class variables / class methods / instance variables / examples Ways Start by supplementing the methods previously wrote: In the javascript, all the way to have a method call and apply. These two methods can simulate the object to call methods. Its f

  • javascript basic object-oriented technology (iv) 2009-03-11

    Category, constructor, prototype First to illustrate the point: In the above mentioned elements, each a function contains a prototype property, this property points to a prototype object (Every function has a prototype property that refers to a prede

  • javascript basic object-oriented technology (c) 2009-03-11

    Function javascript function I believe we all wrote a lot, so we only briefly outline here. Create function: function f (x) {........} var f = function (x) {......} Above, these two forms can be created, called f () function, but the latter form can

  • javascript basic object-oriented technology (f) 2009-03-25

    Implementation of a getNext, on the implementation of the first b () function. Since function b () depends on the function of the scope temp, so temp in memory function will always exist. Function b implementation, the first search i, at b the corres

  • JavaScript Basic Usage 2009-04-29

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTEN

  • python2.x study notes (13) - functions and functional programming 2010-03-11

    1. The concept of keyword parameter called only for the function. This idea is to let the caller by the name of the function call parameters to distinguish between parameters. This specification allows parameter missing or not in order, because the i

  • Practice reading notes java Introduction to concurrent programming 2010-12-07

    package cn.wtu.executor; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; /** * * Versi

  • javascript basic object-oriented technology (b) 2009-03-11

    Primers (integer type 0 ~ ~ 2 ** 32-1) to get value. Array itself is an object, so the operation of the target property is also fully fit in the array. Js code var array = new Array ( "no1", "no2"); array [ "po"] = "prop

  • Of object-oriented programming javascript 2010-06-23

    http://www.ioldfish.cn/?p=238 Around several object-oriented Keywords: encapsulation, inheritance, polymorphism, expand

  • [Linux Device Drivers 3rd Notes] 2. Modules and kernel programming concepts 2010-12-07

    Preparation: Come up with a kernel source Tree. (The latest stable kernel is 2.6.36.1, you could Get IT from kernel.org ) Build kernel and install it on your system. Concrete can be compiled for your reference in the ubuntu10.10 linux-2.6.36.1 kernel

  • [Zz] The basic idea of ​​dynamic programming 2011-07-28

    Previous | Return | Next Dynamic Programming Dynamic Programming Starfish ( starfish.h @ china.com ) Summary This article describes the basic idea of ​​dynamic programming and the basic steps, through case studies the use of dynamic programming algor

  • Basic 转 JavaScript JSBasic 2013-01-21

    JSBasic 网站 : https://github.com/danielflower/JSBasic JSBasic 是一个将 BASIC 代码转成 JavaScript 的编译器,使用 Basic 编写,可直接在浏览器上运行. Basic 代码: 10 print "Hello world" 20 goto 10 会被转成如下图的程序: 授权协议: 未知 开发语言: JavaScript Basic 操作系统: 跨平台

  • JavaScript how to systematically study 2010-11-12

    In the past, JavaScript is used to do some simple web effects, such as form validation, floating ads, etc. So then JavaScript is not taken seriously. Since the AJAX became popular, people found that using JavaScript can give users a better experience

  • JavaScript learning process and experience 2011-01-10

    Transfer from: http://www.cnblogs.com/webflash/archive/2010/08/14/1799668.html I. Introduction In the past, JavaScript is used to do some simple web effects, such as form validation, floating ads, etc. So then JavaScript is not taken seriously. Since