JavaScript Object Properties and methods summary

Source: Internet
Author: User
Tags local time natural logarithm square root time in milliseconds

1 JavaScript Object Properties and methods summary2Date: 2015-03-06Editor: www.jquerycn.cn3 In detail, JavaScript Object properties and Object methods related knowledge, including JavaScript strings, arrays, dates and other properties of the object and common methods, the need for a friend reference. 4 The main contents of this section:5 JavaScript Object Properties and Methods6  7 a detailed summary of the JavaScript object property method is provided for the friends of the jquery Chinese web. 8  9 Array: An ordered collection of series elementsTen Properties: OneLength: Used to get the number of array elements, both the maximum subscript plus 1 A Method: -  -  theSortfunction): In the case where no sort number is specified, the alphabetical order of the elements, if not the string type, is converted into a string, sorted; - reverse (): Reverses the order of the elements in the array; - concat (Array1,arrayn): Used to merge n arrays into the array1 array; - Join (String): Used to merge elements of an array into a string, string as a delimiter, such as omitting a parameter, is merged directly, without separating; + Slice (start,stop): Used to return the element in the array start to stop, if the argument is negative, the countdown start or stop element; - toString (): Returns a string of all elements of the array, separated by commas; +   A strings (String) at Properties: - length: Used to return a string in the same way as an array; - Method: -   -  -Anchor (): This method creates the same markup as the anchor in HTML, the format <a name= "" .....>, Access String.anchor (Chorname) by the following methods in toUpperCase (): Converts a string to uppercase; - toLowerCase (): Converts a string to lowercase; toIndexOf (A, A, B): finds the position of character a in the string and returns if B is omitted, and defaults from 0location search; + Chartat (i): Returns the first character in a string; -SUBSTRING (start,end): Returns the string from Start-all characters between end (but does not return the character of End itself OH); the Sub (): Displays the specified string in subscript format; *   $ Day (date):Panax Notoginseng define the method: -   the  +A:varnewdt=NewDate ()-creates a time object and assigns a value to the current time; AB:varnewdt=NewDate (milliseconds)--creates a time object and sets the value of the object in milliseconds with the GTM delay time; theC:varnewdt=NewDate (String)-assigns a value to the newly created time object using a specific time string in a format that matches the parse method of the Date object; +D:varnewdt=NewDate (year, month, day, hour, minute, second, millisecond)--assign values to the objects in the order of the year, month, day, hour, minute, second, and millisecond; -   $ method: Get time; set time; format Conversion $ A: Get Time -   -  theGetDate ()-----gets the current full time; -GetYear ()------gets the current yearWuyiGetmonths ()----get the current month theGetDay ()-------gets the current date day -GetHours ()-----gets the current hour WuGetminutes ()---gets the current minute -Getseconds ()---gets the current seconds AboutGetTime ()------gets the current time, in seconds $gettimezoneoffset--Gets the current time zone offset information -   - B: Set the time -In contrast to the above acquisition, change the get to set, for example getDate ()--->setDate () A   + C: Conversion method the   -  $Togtmstring ()------a string converted to a Greenwich mean time expression; thetoLocaleString ()----Convert to local time expression string theToString ()----------convert time to String theParse---------------read time from a string representing time theUTC-----------------returns the gap from Greenwich Mean time to a specified time in milliseconds -   in Math Mathematics: the Properties: Note that the properties in the Math object are read- the   About  theE (=2.7182)------the natural logarithm of the bottom (concrete meaning, I do not understand, alas, and mathematics close to the things I do not understand, depressed!) ) theLN10 (=2.30259)---natural logarithm of 10; theLN2 (=0.69315)-----natural logarithm of 2; +PI (=3.1415926)----Pi -Sqrt1_2 (=0.7071) The square root of--1/2 theSQRT2 (=1.4142)----square root of 2BayiLOG2E (=1.44269)---base 2, the logarithm of e theLOG10E (=0.43429)--logarithm of base e of 10 the   - method: In fact, the use of not much, depressed, all out of it -   the  theSin (a)----to find the sine of a theCOS (a)------to find the cosine of a theTan (a)------to find the tangent of a -ASIN (a)-----to find the inverse sine of a theAtan (a)-----to find the inverse cosine of a theEXP (a)------to find the exponent of a theLog (a)------to find the natural logarithm of a94Pow (a,i)----to find the i-square (exponentiation) of a theRound (a)----rounding the A operation thesqrt (a)-----ask for the square root of a theABS (a)------to find the absolute value of a98Random ()----take a random number AboutMax (A, b)----take a larger number -Min (A, b)----take a smaller number101  102 Note: The parameters of the function are floating-point types, and the trigonometric function's parameters are radian values, not degrees103  104 JavaScript built-in functions the Escape () and unescape (): Encode and decode a string106 eval (String): Used to execute the operation or statement represented by a string107For example:vara=0;varstr1= "A+=a"; eval (str1);108 parseint () and parsefloat (): Converts the value of a text box to an integer or floating-point number109 Note: parseint () is not rounding a number, but cutting the tail theIsNaN (): The complete E-text is (was not a number), as the name implies, to determine whether the string is numeric, for exampleif(IsNaN ("Sky-Piercing Series Tutorial"))111   the Custom objects: There are two ways to initialize objects and define constructors113 A: Initialize the object theFor example: Object ={Attribute 1: value 1; Property 2: Value 2; .... Attribute N: Value n}, note that each attribute \ value pair is separated by semicolons; the   the B: The object that defines the constructor117 For example:118  119  -Copy Code code example:functionFunction Name (property 1, Property 2, ...). Attribute N) {121  This. property 1 =attribute value 1;122  This. property 2 =attribute value 2;123  This. Attribute n=attribute value N;124  This. method Name 1 =function name 1; the  This. Method Name 2 =function name 2;126 }127   - Note: The method name and function name can have the same name, but the function must already be defined before the method invokes the function, otherwise an error occurs129Creating a new instance of a custom function is the same as using theNewstatement.  the  131 Browser Object the Window object: He belongs to the central level, in all the object of the highest, plainly, without him, you all do not play;133  134 Properties:135  136 137Closed----------used to determine if the window is closed;138ER----------Store () method to open the window's parent window;139Defaultstatus---The status bar displays the information by default; $Status----------the information currently displayed in the status bar;141Document,location,history---is important142 Method:143  144 145Alert (text)-------------pop up a message box146Confirm (text)-----------Confirmation Information box, parameter is confirmation information147Prompt (text,default)----Popup Input dialog, parameter is prompt information and default value148  149 Document object: Includes various features of the current page, such as title \url\ background \ Language \ Modification time, etc. Max  151 Properties: the  153 154Title------------Document title155LastModified-----file Last modified time156URL--------------the address of the page that corresponds to the document157Cookie-----------used to create and obtain cookie information158BgColor----------background color of the document159Fgcolor----------the foreground color of the document theLocation---------Save all page address information for a document161Alinkcolor-------activating the color of the connection162LinkColor--------the color of the link163Vlinkcolor-------The colors of the links that have been browsed164  165 Method:166  167 168Write (text)-----Write text or labels to a document without wrapping169Writeln (text)---Write text or labels to a document, wrapping at the last character the()----------Open a new document for example ("Address", "Window name", "style")171Close ()---------Close the current document172  173 Location object: Contains all page address information for the current document174  175 Properties:176  177 178Protocol-----------Communication Protocols179Host---------------host name of the Web server on which the page resides thePort---------------port number for server communication181Pathname-----------the path to the document on the server182Hash---------------anchor tag information for page jumps183Searce-------------information that the page submits to the server for searching184Hostname-----------the name and port number of the host, separated by a colon185href---------------the full URL address186  187 Method:188  189  theAssign (URL)--------navigate the page to another address191Reload-------------Refresh Page192Replace (URL)-------use a page of the specified URL instead of the current page193  194 History : This object includes previously visited URL information195  196 property: Length, returns the number of URLs197 The method is mainly Go (n), which loads the relative page. 198  199 These are some of the commonly used objects in JavaScript properties and methods, we hope to help.  $  

JavaScript Object Properties and methods summary

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.