Vi. JavaScript data type (ii)

Source: Internet
Author: User

1.4 Boolean Type

Literal value: True, False

You can call the Boolean () function on a value of any data type, and always return a Boolean value.

Data type The value converted to true Value converted to False
Boolean True False
String Any non-empty string "" (empty string)
Number Any non-0 digits (including infinity) 0 and Nan
Object Any object Null
Undefined N/A Undefined

1.5 Number Type

var intnum = 55; Integer

var floatNum1 = 1.; No digits after the decimal point--resolves to 1

var floatNum2 = 10.0; integer--resolves to 10

var floatnum = 3.125e7; equals 31250000

var 0.2 0.1 ; alert (a//  0.30000000000000004

NaN, or non-numeric (not a number) is a special value that represents an operand that would have returned a numeric value.

No value is returned (this will not throw an error).

// false
Alert (IsNaN (NaN)); // true    Alert (IsNaN (10)); // False (10 is a numeric value)    // False (can be converted to a value of ten)    Alert (IsNaN ("Blue")); // true (cannot be converted to numeric value)    Alert (IsNaN (true//False (can be converted to a value of 1)

There are 3 functions that can convert non-numeric values to numeric values: Number (), parseint (), and parsefloat ().

Vi. JavaScript data type (ii)

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.