Home > Web Front-end > JS Tutorial > body text

Traversing for in and usage of with in javascript_Basic knowledge

WBOY
Release: 2016-05-16 16:25:18
Original
1259 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template