Edit in JSFiddle

var o1 = {};
var o2 = Object.create(o1);
var o3 = Object.create(o2);

o1.a = undefined;
o2.b = undefined;
o3.c = undefined;

document.querySelector("result").innerHTML = objKeys(o3);

function objKeys(obj) {
  if (!obj) return [];

  // consult the [[Prototype]] chain, only enumerable properties
  return Object.keys(obj).concat(objKeys(Object.getPrototypeOf(obj)));
}
<result></result>