Leetcode 2620: Closure Function with Incrementing Counter

Day 2- of Leetcode 30 days of javascript. Problem 2620 The problem statement was to return a function inside a parent function, and when the parent function is called, it should return in subsequent ascending +1 result. i,e n, n+1, n+2 for any value of n. This problem was based on closures and lexical scope of higher ordered function. There are many approach for this problem but I tried by setting a counter n - 1 and then incrementing it by 1, ie counter += 1. I am open to advice and please comment on how can I improve. #Leetcode #coding #javascript #Logic #growth #programming #higherorderfunction #closures #lexicalscope #scope

  • text

To view or add a comment, sign in

Explore content categories