Home >Web Front-end >JS Tutorial >Traversing for in and usage of with in javascript_Basic knowledge

Traversing for in and usage of with in javascript_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 16:25:181275browse

for in loops through the properties of an object

With statement: (Object operation statement)
                   Function: Create a default object for a program

Format:

Copy code The code is as follows:

with(){

                                                                                                                                                                           

        }


Specific example:

Copy code The code is as follows:

/*Running effect:
person.name = Rene Liu
person.gender = female
*/

Do you guys have some understanding of the usage of traversing for in and with in javascript? This is the basis for learning javascript.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn