In operator Usage Analysis in javascript, javascript Operator

Source: Internet
Author: User

In operator Usage Analysis in javascript, javascript Operator

This example describes the in operator usage in javascript. Share it with you for your reference. The specific analysis is as follows:

The in operator wants its left operand to be a string or can be converted to a string, and its right operand to be an object. If the right object has a property name named the left operation value, then the expression returns true:

Var point = {x: 1, y: 1 }; "x" in point // true "z" in point // false "toString" in point // truevar ary = [1, 2, 3]; "0" in ary; // true, ary contains index 0 ("0" is switched to 0); 1 in ary; // true, ary contains Index 13 in ary; // false

I hope this article will help you design javascript programs.

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.