My code ise this:
var cem = { "name": "cem topkaya" };
f_PropertyBul(cem);
function f_PropertyBul(obj) {
for (var prop in obj) {
document.writeln(obj + " prop: " + prop + " propertyIsEnumerable:" + obj.propertyIsEnumerable(prop) + "<br/>");
if (obj.propertyIsEnumerable(prop)) {
f_PropertyBul(obj[prop]);
}
}
}
I know there are a lot of question and answers about that but i didn't get why i get this result :
[object Object] prop: isim enumaret: true
cem topkaya prop: 0 enumaret: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
c prop: 0 propertyIsEnumerable: true
.
..
....
At the end, i am reaching the last property as a string. But it still says that it has propertyIsEnumareble true .
I just want to send an object and search an property name and its value. when it found i just want to break search and return back one property of my JSON object.