Standard object in JS

Source: Internet
Author: User

Standard object in JS
1: Do not use new number (), New Boolean (), New String () to create the wrapper object;
2: Use parseint () or parsefloat () to convert any type to number;
3: Use String () to convert any type to string, or call the ToString () method of an object directly;
4: It is not usually necessary to convert any type to Boolean, because you can write directly if (MyVar) {...} ;
The 5:typeof operator can determine number, Boolean, String, function, and undefined;
6: Determine the array to use Array.isarray (arr);
7: Judge null use MyVar = = = NULL;
8: Determine if a global variable exists with typeof Window.myvar = = = ' undefined ';
9: Inside the function to determine whether a variable exists with typeof MyVar = = = ' undefined '.

Standard object in JS

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.