+ 1
Object.entries not working
Why isn’t this code logging anything? I asked chatgpt and it says it should work. Is it a sololearn playground thing? https://sololearn.com/compiler-playground/WLx71EpV4726/?ref=app
2 Antworten
+ 3
Zvi
it is working.
you just have to format the result to make it easier to understand.
function Obj(q,w,e){
this.q=q;
this.w=w;
this.e=e;
this.meth=function(){
console.log(this.q+this.e)
}
}
let obj1=new Obj("p","o","i");
let a = Object.entries(obj1);
for (const [k,v] of a){
console.log(`${k}: ${v}`);
}
+ 2
Bob_Li Thanks!👍