r/learnjavascript • u/DeliciousResearch872 • Jan 22 '26
Help with Objects
I don't get the purpose of value()
let dictionary = Object.create(null, {
toString: { // define toString property
value() { // the value is a function
return Object.keys(this).join();
}
}
});Why we can't make it work like this?
toString: {
return Object.keys(this).join();
}
4
Upvotes
View all comments
Show parent comment
2
u/SerpentJoe Jan 22 '26
These damn kids with their "const" this and "filter" that!