Commit 1b552385 authored by Rohan Sakhale's avatar Rohan Sakhale

Minor

parent b76df804
Pipeline #5858552 passed with stage
in 2 minutes and 27 seconds
......@@ -10,15 +10,15 @@ tags:
---
### Summary
I have always used stack program as the first simplest example to express something new but powerful as previously I had shown Stack in Android App and now **Stack Program in Object Functional Programming language using Javascript**
I have always used stack program as the first simplest example to express something new but powerful as previously I had shown [Stack in Android App](https://rohansakhale.com/2012/03/17/Stack-Program-for-Android/) and now **Stack Program in Object Functional Programming language using Javascript**
Here we will need a node js server to run this program which is saved as js extension
In the following program, we created a closure of the Stack function and passed/called the messages like push, pop & print.
The var variables within Stack function are local to stack function and hence we can say this is an idiom for achieving the encapsulation principal of a class.
The `var` variables within Stack function are local to stack function and hence we can say this is an idiom for achieving the encapsulation principal of a class.
Since obj is the object here, so what if we say `obj.sp = 20;`
Since `obj` is the object here, so what if we say `obj.sp = 20;`
Don't worry, this will create a new variable inside obj table/object which will not affect the functionality of the closure that we are working onto i.e. Stack for now.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment