---
title: "查看JS对象中的所有属性"
author: "iTommy"
date: "2016-03-03T10:17:24Z"
tags: []
categories: ["Web前端"]
slug: "js"
draft: false
lastmod: "2016-03-03T10:17:24Z"
id: 2280167
url: "https://itommy.iteye.com/blog/2280167"
---

一个js的function以类似json的形式查看对象属性信息：

```
function displayProp(obj){    
    var names="";       
    for(var name in obj){       
       names+=name+": "+obj[name]+", ";  
    }  
    alert(names);  
}  
```

 

[http://01404421.iteye.com/blog/1517221](http://01404421.iteye.com/blog/1517221)