JS Interview - Revealing Module Pattern - Question 3

preview_player
Показать описание
This is the third episode in the JavaScript Interview Question Series.
This video covers how to create a revealing module pattern with JS.

Рекомендации по теме
Комментарии
Автор

i.i.f.e. - Immediately Invoked Function Expression
_Explained industry jargon is always appreciated._

quietackshon
Автор

Love this pattern! Super useful for creating private and public functions/variables!

patrickc.
Автор

Great vid, 1 question - does myModule have to be an IIFE? Can it also be a regular function expression that is invoked later?

badselection
Автор

Nice Series Sir. Thanks a Lot. Sir Can you please make a video series on Meta Programming Concepts and better approach of writing codes in JS and about the concept of Functional Programming over declarative programming and I just want to Thank you for all these tutorial and your efforts. :)

sourishdutta
Автор

I just learned about Factory Functions that return object. How exactly is the IIFE different from factory functions? They appear very similar

andrewgarfinkel
Автор

Is this a valid alternate answer?

let myModule = {
render: () => {
let data = [];
let add = () => {};
let remove = () => {}
}
}

This doesn't use an IIFE and myModule only exposes the render() function.

pranavlotlikar
Автор

Hi @Steve Griffith.
I also learned this concept from Bob Tabor, Microsoft Staff.
He said that the revealed properties in the revealing module pattern can be overwritten, as opposed to it being impossible to overwrite properties in the regular module pattern. I don't see how this is so. Can you give an example?

andrescastillo
Автор

Hi Steve, is revealing and modular pattern is same? for an example


return {
render: function() {
_render()
}
}

nitinmali
Автор

Some time we used a pattern but we don't know the name of it. 😀

shujaatali