DEV Community

Discussion on: How to learn javascript to become a better developer.

Collapse
 
maniflames profile image
Maniflames

Hi Kaustav welcome to DEV!
It might be good to know that you can format code on here to make it a bit more readable. You can do this using this markdown notation. In that case your closure function at point four would look like this:

function closureExample(i) {
    return function cloureInnerVariable(y){
        return i+y;
    }
}

const value1 = closureExample(1);
const value2 = value1(2);
console.log("value of closure", value2);
Enter fullscreen mode Exit fullscreen mode
Collapse
 
kaustavkarmakar2 profile image
kaustav karmakar

Thanks for suggesting...i will do that