Javascript implicit type conversion steps

Source: Internet
Author: User

Javascript implicit type conversion steps
Here, implicit type conversion is a conversion caused by =. If NaN exists, return false and check whether there are any Boolean values. If there is a Boolean value, convert the Boolean value to a number and check whether there are any strings. In three cases, the opposite object is an object and the object is converted using toString; the opposite party is a number, the string is converted to a number, the other party is a string, direct comparison; other returns false if a number, the other party is an object, the object is valueOf for comparison, and other returns falsenull, undefined does not perform type conversion, but they must be in the same order, which is frequently asked during interviews. Below are some miscellaneous. Do it yourself 0 = undefined 1 = true 2 = {valueOf: function () {return 2} NaN = NaN 8 = undefined 1 = undefined null = {toString: function () {return 2} 0 = null = 1 {toString: function () {return 1}, valueOf: function () {return [] }== 1

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.