Write a function called myFun which has an object as its parameter and returns the name of properties of that object in an array. For instance, if it receives {a:1,b:3}, as its parameter, it should return [a, b], or if it receives {u:4, k:3, h:5}, it should return [u, k, h].
Note I am aware of Object.Keys(object) returns ['a', 'b', 'c']
//this function should return the name of the property
function myFun(object) {
object = {
a: 1,
b: 2,
c: 3
}
for (obj in object) {
console.log(obj);
}
}
myFun();
//testcase : console.log(myFun({a:6})[0]) which should return [a], is it
actually possible or am I asking the wrong question?