JavaScript prototypes and built-in objects 1

Source: Internet
Author: User
Tags prototype definition square root

Prototype definition
    • Each object has a prototype
    • The prototype is still an object
    • Simulating the implementation of object-oriented inheritance
Prototype chain
    • The prototype of the object is also a prototype
    • Objects can inherit properties on the prototype in addition to their own properties
Get prototypes
    • Object. Proto
    • constructor. prototype
Properties of the manipulation prototype
    • The prototype itself is the object, the same object as the operand
Determines whether a property is self-contained or a prototype inherits
    • hasOwnProperty ()
Create an object in ECMA5 and specify the object's prototype
    • Object.create ();
Boolean Creation method
    • Direct amount Var b=true;
    • Conversion function Var B1=boolean (true);
    • constructor var b2=new Boolean (False)
Property
    • Constructor return Object type
Method
    • ToString () turns the Boolean value to a string and returns the result
    • ValueOf () returns the original value
Number Creation Method
    • Direct volume
    • Conversion functions
    • constructor function
Property
    • Number.MAX_VALUE
    • Number.min_value
Method
    • ToFixed () retains decimals for the specified number of digits, reserved integers by default
    • Toexponential () is expressed in the form of scientific notation.
    • ToString () is converted to a string. You can convert decimal to any binary string
How string is created
    • Direct volume
    • Conversion functions
    • constructor function
Property
    • Length string Lengths
Method
  • CharAt (index) returns the character at the specified position, which can be substituted with the [] operator
  • charCodeAt (Index) returns the encoding of the character at the specified position
  • String.fromCharCode () converts Unicode encoding to characters
  • Concat () joins one or more strings, which can be replaced by the + operator
  • IndexOf () returns the position of the first occurrence of a character (string) in a string
  • LastIndexOf () returns the position of the last occurrence of a character (string) in a string
  • SUBSTR (start [, length]) intercepts the string
  • SUBSTRING (start [, end]) intercepts the string
  • Slice () with substring
  • Split () splits a string into an array of root arrays in the same way Arr.join () opposite
  • toUpperCase () Converts a string to uppercase
  • toLowerCase () Converts a string to lowercase
  • Trim () Remove spaces on both sides of the string
  • Replace ()
  • Match ()
  • Search ()
Date Creation Date
    • constructor var date=new date ()
Method
  • GetYear ()
  • getFullYear () A.D.
  • GetMonth () starting from 0
  • GetDay () Day (days of the week)
  • GetDate () Day (date)
  • GetHours ()
  • Getminutes ()
  • Getseconds ()
  • Getmilliseconds () MS
  • GetTime () from January 1, 1970 0:0 0 seconds to present the number of milliseconds
  • getTimezoneOffset () The offset unit of the standard Time zone is the minute
  • getUTCHours () Standard Time zone
  • Getutc .....
  • setUTCHours ()
  • Set ...
  • SETUTC ...
  • TOUTCSTIRNG ()
Time stamp
    • Number of seconds or milliseconds since the beginning of Unix
    • Unix 1970
Math Property
    • Pi π
Method
  • ABS () to find absolute value
  • sqrt () to find the square root
  • Pow () to ask several Parties
  • Max () to find the maximum value
  • Min () to find the minimum value
  • Round () rounded rounding
  • Floor () Rounding and rounding
  • Ceil () into a rounding
  • Random () returns the decimal number between 0~1

JavaScript prototypes and built-in objects 1

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.