-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpcv.js
More file actions
39 lines (26 loc) · 909 Bytes
/
pcv.js
File metadata and controls
39 lines (26 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Employee(name){
this.name = name;
}
//var objs = []; // we'll store the object references in this array
function walkTheObject( obj ) {
var keys = Object.keys( obj ); // get all own property names of the object
keys.forEach( function ( key ) {
var value = obj[ key ]; // get property value
// if the property value is an object...
if ( value && typeof value === 'object' ) {
// if we don't have this reference...
if ( objs.indexOf( value ) < 0 ) {
objs.push( value ); // store the reference
walkTheObject( value ); // traverse all its own properties
}
}
});
}
//walkTheObject( this ); // start with the global object
//console.log(objs);
Employee.prototype.getName = function(){
return this.name;
}
Employee.prototype.setName = function(name){
this.name = name;
}