(a): how the module is writtenWeb pages are becoming more and more like desktop programs, requiring a collaborative team, schedule management, Unit testing, etc... Developers have to use the software engineering approach to manage the business logic
I. Traditional PROTOTY inheritancefunctionParent () { This. Name = "Thisisname";} Parent.prototype.sayName=function() { return This. Name;};functionChild () { This. Age = "Thisisage";} Child.prototype=Newparent ();/point to the parent instance
Null and ""the DifferenceProblem one: null and""the DifferenceString s=NULLthe String.Trim () will throw an empty exceptionString s=""; String.Trim () will not throw, why?A: null means that an empty object is declared and is not a string at all.
First, let's take a look at the code, each of which actually represents a JS file. So the following is actually a three JS file. The first one is the main file that we want to run, and the next two are A, b files.From above you can read a, b two
There are 3 common ways to create objects:① How variables are declaredvar function () {Console.log (this. key1)}}var array = [1, 2, 3];You can continue to add properties and methods to obj1 , such as:Obj1.color = "Red"function () {console.log ("AAA")
Can write a nssring category to add some methods to NSString, and these methods are some regular expressions.Like writing a class called Helper, it's nsstring+helper.The. h and. m files are then written.#pragma mark-Verify related/* Verify related *
Read Catalogue
Basic methods
Supports chained calls
Let the plug-in receive parameters
Object-oriented plug-in development
About namespaces
About variable definition and naming
Advantages of compression
Tools
First, we need to know that JavaScript differs from traditional object-oriented programming (OOP) in that it has no traditional class, and that everything in that language is object-based and relies on a set of prototype (prototype) systems.
For this point in JavaScript, you may be as confused as I am, and today, by learning some of the authors ' deep understanding of this, it is useful to transcribe the following:This article mainly cited to: Chasing dream son, if necessary can guide
First, JS to determine whether an object is an empty object1) Judging by the. Stringify method that comes with the JSON.// JSON-stringify method to turn JSON into JSON string var c =if(json.stringify (c) = = "{}") { Console.log ("is empty
1. Data typeJS data type Total 6 kindsrespectively:Numeric, String, Boolean, Undefind,null, object the most basic data types are 3 kinds: numeric, String, and Boolean objects can be divided into 3 subtypes: narrow objects, arrays, functionsnarrow
Read Catalogue
Basic methods
Supports chained calls
Let the plug-in receive parameters
Object-oriented plug-in development
About namespaces
About variable definition and naming
Advantages of compression
Tools
The first two summarizes the basic data types in JavaScript (value types ) and their in-memory storage, a simple understanding of memory space, and a second summary of the use of this in layman's, We know that the use of this depends on how the
Prototypes and prototype chainsIn the object itself can not find the specified attribute, will be found on the prototype of this object, the prototype is also pointing to an object, the object can not find the corresponding property, then continue
First, what is the "non-constructor" inheritance?For example, there is now an object called "Chinese".
var Chinese = {Nation: ' China '};
There is also an object called "Doctor".
var Doctor ={Career: ' Doctor '}
How can I
Basic data type:Number,boolean,string,undefined,null reference types: object,array,function, Difference: Reference types can add properties and methods, and primitive types cannot typeof operators: typeof is the best tool to determine whether a
class:A class of things with the same attributes and skills.object:the specific performance of the class.class keywordClass Name: (class name should be capitalized first)code block.country = ' China ' first part: Static variable, static fielddef
Original: http://mozilla.com.cn/post/21667/===========================Last time, the team had several times to share the force, here to the West wind master to share the inheritance mechanism a little to tidy up a bit, appropriate add some
2. Dynamically add, modify, and delete object properties and methodsFor example: Create an empty object user with Class object () and modify its behavior.(1) Adding attributesvar user=New// Create an empty object with no properties and methods //
Data typeThere are 5 simple data types (also known as basic data types) in javascript: Undefined, Null, Boolean, number, and string. There are 1 more complex data types--object,object essentially consist of a set of unordered name-value pairs.typeof
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.