Home > Web Front-end > JS Tutorial > How to traverse the properties of an object?_javascript tips

How to traverse the properties of an object?_javascript tips

WBOY
Release: 2016-05-16 19:26:28
Original
1046 people have browsed it

[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]
鯘聱gna

[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute <script> function Employee(name, age, title, salary)//括号里的东东是参数,还是属性?如何遍历? { this.name = name; this.age = age; this.title = title; this.salary = salary; this.promotion = promotion; } function promotion(new_title,percent_raise) { var salary_increase = this.salary * percent_raise; this.salary = this.salary + salary_increase; this.title = new_title; } function newdx(){ var aq=new Employee("aq",22,"qigai",3000) alert(aq.name+"的职业是"+aq.title+",薪水是"+aq.salary) aq.promotion("bangzhu",1) alert(aq.name+"的新职业是"+aq.title+",薪水是"+aq.salary) } newdx() </script>]<script> function hutia(){ for(var i=0;i<arguments.length;i++)document.write(arguments[i]+","); document.write(" "); } hutia(1,2,3,4); hutia("haha","hehe", true, false); hutia("Show me the money", "Operation cwal", "Food for thought", "the gathering"); </script>
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