JS Object-Oriented learning Note VI (variable)

Source: Internet
Author: User

"1. Boolean corresponding to the value"
False Boolean value    false object      null number      NaN  (not a number) digit      0 initial value    undefined null string  "" True string "0" or other No more than six kinds of values



"2. Null differs from undefined "
Null       is a given empty object or array undefined  is a variable initializer that is declared or undeclared but not assigned, so it is not possible to            use the Var declaration undefined            The value of all variables that have no initial value is undefined



"3. The type of the detection variable "
var A; typeof (a); undefined var a = "0"; typeof (a); string var a = 0; typeof (a); number var a = null,     b = new Array, typeof (a),//object typeof (b),//object var a= function () {    alert (12 ); } typeof (A); function



"NOTE:" All variables must be declared using VAR before they are used

Detects if a variable exists if (typeof (Somevar)!== "undefined") {    //exist coding here ...}



"4. The maximum value in JS "
var maxnumber = Infinity; Note Infinity is a built-in constant var minnumber =-infinity; Minimum number of JS negative numbers



JS Object-Oriented learning Note VI (variable)

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.