Stack Overflow Asked by user13443583 on November 15, 2021
I understand this:
let blah = null;
let blah = undefined;
let blah;
What I don’t understand is this:
let obj = {}
// notice the empty value assignment and the assignment that immediately follows
obj.blah =
obj.blah = function(params) {
// some code
}
Is the empty assignment the same as let obj.blah;
? I’ve seen this in a few npm packages where the key is provided a value directly beneath the empty value assignment of the same key. Is there a particular purpose to writing code this way? I’m refactoring a package to streamline its use, and I don’t want to simply delete this because of my ignorance. Any help will be greatly appreciated.
It's equivalent to
obj.blah = ( obj.blah = function () {} );
There's absolutely no reason to do that.
Answered by Quentin on November 15, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP