JavaScript Core Reference Tutorial built-in objects _js object oriented

Source: Internet
Author: User
Tags acos constant numeric local time natural logarithm numeric value square root
This standard is based on JavaScript (Netscape) and JScript (Microsoft). Brendan Eich, of Netscape (Navigator 2.0), invented the language, which has appeared in all Netscape and Microsoft browsers since 1996. The development of ECMA-262 began in 1996, and in July 1997 the ECMA General Assembly adopted its first version.
This series of tutorials is designed to share my notes and tips for learning JavaScript. This series of tutorials is expected to be divided into five sections.
The first part: JavaScript built-in objects.
Part Two: Browser objects.
Part III: Document Object model.
Part IV: Object-oriented encapsulation and closure of the application.
Part five: series of topics (regular expression, framework learning, etc ...).
JavaScript is not exactly an object-oriented language, but it should be an object-based programming language, although we can simulate object-oriented features, but once it's out of its container and some basic object components, JavaScript won't be able to do anything. Without the support of the DOM component, we would not be able to write an elegant and interactive user interface, and without the support of the XMLHttpRequest component, we would not be able to achieve the exciting Ajax. So, to learn JavaScript well, we have to have a good grasp of the use of JavaScript basic components.
OK, let's start with the first part and start with the JavaScript built-in object chapters.

Global Properties

The
Infinity indicates positive infinity values
NaN non-numeric value
undefined Undefined value
decodeURI () decodes a string of encodeURI () escapes. The
decodeuricomponent () decodes a string of encodeURIComponent () escapes.
encodeuri () Returns a copy of the parameter, some of which are replaced by a hexadecimal escape sequence, and it is recommended that you encode the string using encodeURIComponent (). The
encodeuricomponent () Returns a copy of the parameter, with some of the characters replaced by the hexadecimal escape sequence.
Escape () replaces some character string encoding with an escape sequence.
eval () computes the JavaScript code string, returning the result. The
isfinite () verifies that a value is a number that is infinitely large. The
isnan () verifies that a value is non-numeric.
parsefloat () parses a number from a string.
parseint () parses a number from a string. The
unescape () decodes strings that are encoded with escape ().

JavaScript built-in objects

  1. Object objects

    Constructor A reference to a JavaScript function that is the constructor of an object.
    hasOwnProperty () Checks whether the object has a locally defined (not inherited), property with a specific name.
    isPrototypeOf () Checks whether the object is a prototype of the specified object.
    propertyIsEnumerable () Checks whether the specified property exists, and whether it can be enumerated with a for/in loop.
    toLocaleString () Returns a string representation of the object's localization.
    ToString () Returns a string representation of an object.
    ValueOf () Returns the original value of the object, if present.
  2. Arguments object (defined within function only)

    Callee A reference to the function that is currently executing.
    Length The actual number of arguments passed to the function.
  3. Array Object

    Length The number of elements that the array contains.
    Concat () Adds an element to an array (this operation does not change the value of the original array).
    Join () Converts all elements in an array into strings and joins them.
    Pop () Deletes and returns the last element of the array.
    Push () Adds an element to the end of the array, and returns the new length of the array (the last element in bug:ver1.2).
    Reverse () Reverses the order of elements in an array on the original array.
    Shift () Deletes and returns the header element of the array.
    Slice () Returns a child array of an array that does not modify the original array (Bug: Start cannot be negative in IE4).
    Sort () Sorts the arrays from the original array.
    Splice () Inserts, deletes, replaces an array element.
    Tolocalstring () Converts an array to a local string.
    ToString () Converts an array to a string.
    Unshift () Inserts an element at the head of the array, returning the new length of the value to the group.
  4. Boolean objects (0, NaN, null, empty string, and undefined are converted to false)
  5. Date Object

    GetDate () Returns a day of the month.
    Getday () Returns a day of the week.
    getFullYear () Returns the year in the date.
    getUTCFullYear () Ditto.
    GetHours () Returns the hour field of an object.
    getUTCHours () Ditto.
    Getmilliseconds () Returns the millisecond field of an object.
    getUTCMilliseconds () Ditto.
    Getminutes () Returns the minute field of an object.
    getUTCMinutes () Ditto.
    Getmouth () Returns the month field of an object.
    Getutcmouth () Ditto.
    Getseconds () Returns the second field of the object.
    getUTCSeconds () Ditto.
    GetTime () Returns the millisecond representation within an object.
    getTimezoneOffset () Returns the difference in minutes between the local time of this date and the UTC representation.
    GetYear () Recommended use of getFullYear ().
    Setdate () Set one day of the object month.
    setUTCDate () Ditto.
    setFullYear () Sets the year field in the object.
    setUTCFullYear () Ditto.
    Sethours () Sets the hour field for an object.
    setUTCHours () Ditto.
    Setmilliseconds () Sets the millisecond field for the object.
    setUTCMilliseconds () Ditto.
    Setminutes () Sets the minute field for an object.
    setUTCMinutes () Ditto.
    Setmouth () Sets the month field for the object.
    Setutcmouth () Ditto.
    Setseconds () Sets the second field of the object.
    setUTCSeconds () Ditto.
    SetTime () Sets the individual fields of the object in milliseconds.
    Setyear () Recommended use of setFullYear ().
    toDateString () Returns a string representation of the date part of a date.
    toGMTString () Recommended use of toutcstring ().
    Tolacaledatastring () Returns a string representation of the date part of a date.
    toLocaleString () Converts an object to a string.
    Tolacaletimestring () Returns a string representation of the time part of a date.
    ToString () Converts an object to a string.
    toTimeString () Converts an object to a string.
    ToString () Returns a string representation of the time part of a date.
    toUTCString () Converts an object to a string.
    ValueOf () Converts an object to its internal millisecond format.
    Parse () A static method that parses a string representation of a date and time and returns its internal millisecond representation.
    UTC () A static method that returns the millisecond representation of the specified UTC date and time.
  6. Error Object

    Message An error message that provides exception details.
    Name A string that has a reputation for an exception type.
    ToString () Returns a String representing the Error object.

    The child object type, indicating the specific error type.

    • Evalerror (execution error).
    • Rangeerror (thrown when the number is outside the legal range).
    • Referenceerror (thrown when reading a variable that does not exist).
    • SyntaxError (This error is thrown to notify syntax errors).
    • TypeError (This exception is thrown when the type of a value is wrong).
    • Urierror (thrown by the encoding and decoding method of the URI).
  7. Function object

    Arguments Arguments object, against using this property.
    Caller A reference to the Funciton object that invokes the current function, against the use of this property.
    Length The number of named arguments that are specified when the function is reputed.
    Prototype An object that is used to construct a function that defines properties and methods that are shared by all objects created by the constructor.
    Apply () Invokes a function as a method of the specified object, passing it a specified array of arguments.
    Call () Invokes a function as a method of the specified object, passing it the specified argument.
    ToString () Returns a string representation of the function.
  8. Math Object

    Math.e Constant E, the base of the natural logarithm.
    Math.ln10 10 of the natural logarithm.
    Math.ln2 2 of the natural logarithm.
    math.log10e The logarithm of the 10-base E.
    math.log2e The logarithm of the 2-base E.
    Math.PI Constant π.
    Math.sqrt1_2 Square root of 1/2.
    Math.sqrt2 Square root of 2.
    ABS () static method, the absolute value is obtained.
    ACOs () static methods.
    ASIN () static methods.
    ACOs () static methods.
    Atan () static methods.
    ATAN2 () Static method that calculates the X axis to a point angle.
    Ceil () static method, rounding on a number.
    cos () static methods.
    EXP () static method to compute the index of E.
    Floor () static method, rounding for a number.
    Log () static method to compute the natural logarithm.
    Max () static methods.
    Min () static methods.
    POW () The parameters of parameter 1 are calculated 2 times.
    Radom () static methods.
    Round () static methods.
    Sin () static methods.
    sqrt () static methods.
    Tan () static methods.
  9. Number Object

    number.max_value can be represented. The smallest number that
    number.min_value can represent.
    Number.NaN is not a numeric value.
    number.negative_infinity negative infinity, which is returned when overflow. The
    number.positive_infinity is positive infinity, which is returned when it overflows. The
    toString () converts numbers to strings, using the specified cardinality. The
    tolocalestring () converts numbers to strings, using the local format digital specification. The
    toFixed () converts a number to a string, and the result has a number with a specified number of digits after the decimal point. The
    toexponential () converts numbers to strings, with the result of exponential counting, with a specified number of digits after the decimal point. The
    toprecision () converts a number to a string, and the result contains a valid number for the specified number of digits.
  10. RegExp objects

    Global Whether the object has the nature G.
    IgnoreCase Whether the object has the nature i.
    Lastindex The character position after the last match, used for multiple matches in a string.
    Multiline Whether the object is of a nature m.
    Source The source text of the regular expression.
    EXEC () Performs powerful, generic pattern matching.
    Test () Detects whether a string contains a pattern.
    For more information, you can refer to the JavaScript Core Reference tutorial--regexp objects
  11. String Object

    fromCharCode () A static method that creates a new string with the character code passed as a parameter.
    Length The length of the string.
    CharAt () Extracts the character at the specified position in the string.
    charCodeAt () Returns the character encoding for the specified position in the string.
    Concat () Connect one or more values to a string.
    IndexOf () Retrieves a character or a substring in a string.
    LastIndexOf () Retrieves a character or substring backwards in a string.
    Localecompare () Compares two strings in a local-specific order.
    Match () Performs pattern matching with regular expressions.
    Replace () Performs a find, replace operation with a regular expression.
    Search () Retrieves a substring in a string that matches a regular expression.
    Slice () Returns a fragment or a substring of a string.
    Split () Splits a string into an array of strings, performing a split at the specified boundary character or at the regular expression.
    SUBSTRING () Extracts a substring from a string.
    SUBSTR () Extracts a substring from a string.
    toLowerCase () Convert all characters in the string to lowercase, and then return a copy.
    ToString () Returns the original string value.
    toUpperCase () Converts all characters in a string to uppercase, and then returns a copy.
    ValueOf () Returns the original string value.


    In addition, String has some specific methods with HTML operations, but ECMAScript does not standardize these methods.
    Anchor () Returns a copy of a string in the <a name=> environment.
    Big () Returns a copy of a string in the <big> environment.
    Blink () Returns a copy of a string in the <blink< environment.
    Bold () Returns a copy of a string in the <b> environment.
    IndexOf () Retrieves a character or a substring in a string.
    LastIndexOf () Retrieves a character or substring backwards in a string.
    Localecompare () Compares two strings in a local-specific order.
    Match () Performs pattern matching with regular expressions.
    Fixed () Returns a copy of a string in the <tt> environment.
    FontColor () Returns a copy of a string in the <font color=> environment.
    FontSize () Returns a copy of a string in the <font size=> environment.
    Italics () Returns a copy of a string in the <i> environment.
    Link () Returns a copy of a string in the <a href=> environment.
    Small () Returns a copy of a string in the <small> environment.
    Strike () Returns a copy of a string in the <strike> environment.
    Sub () Returns a copy of a string in the <sub> environment.
    SUP () Returns a copy of a string in the <sup> environment.
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.