I have created the perfect JavaScript data type: a value that is both an object, a function, and a promise. All at the same time!#JavaScript
from hazelnoot@enby.life to (none) on 08 Aug 16:33
https://enby.life/notes/ab6m0tv72r

I have created the perfect JavaScript data type: a value that is both an object, a function, and a promise. All at the same time!

#JavaScript

Screenshot of Node.JS REPL with three commands run:
1. Object.entries(result) returns a single key/value pair: "property" equals "object!".
2. Invoking result() as a function returns a string "function!".
3. awaiting result directly returns string "promise!".

#(none) #javascript

threaded - newest