In other words, when you have a function, you can call the function’s bind function. Pass in an object, and the function will become a member of that object. The object now has a member function identical to the function you started with.
Now, technically speaking, the function itself hasn’t changed. It’s still there and you can use it. Instead, the ECMAScript engine creates a new function identical to the original in all ways, except that new function is now a member of the object.
As with the JSON support, this is actually not new either. There’s a popular JavaScript library called PrototypeJS. This library includes a bind function that does exactly what I’m talking about here. (In fact, it’s identical to the point that it’s clear the ECMAScript designers based their bind function on PrototypeJS’s bind function.) You can read about it here.
Other Enhancements
There are also several smaller enhancements to ECMAScript. I already mentioned the handful of new functions that exist on the main Object object. The Array object now includes in its prototype several handy new functions that will make your array-manipulation life easier; such as indexOf, map, filter and others. Strings now include a trim function, and the basic objects; String, Boolean, Number and Date, now include prototype functions for converting to JSON strings. To see the full list, have a look at the page I mentioned earlier.
Growth in China's output of integrated circuits slows in November as Biden administration reportedly launches…
Facebook parent Meta adds AI voice chat, live translation to Ray-Ban Meta smart glasses as…
Senate study finds Amazon did not implement protections recommended by internal studies over risk they…
US senate majority leader calls for federal deployment of drone detection technology after drone sightings…
After launching in September 2023, TikTok Shop rises to broad popularity with US sales surpassing…
Investment in China's semiconductor industry falls by one-third this year as US tightens restrictions, state…