May 16, 2023, 3:23 p.m. | Dominic R.

DEV Community dev.to

Back again with the second problem in the 30 Days challenge, #2620.





Process


The instructions read as follows.



Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent time it is called (n, n + 1, n + 2, etc).



Here's the unit tests, if you're curious about the return values.



const counter = createCounter(10)
counter() …

algorithms back called challenge counter etc function integer javascript leetcode problem process return value

SOC 2 Manager, Audit and Certification

@ Deloitte | US and CA Multiple Locations

Cyber Systems Administration

@ Peraton | Washington, DC, United States

Android Security Engineer, Public Sector

@ Google | Reston, VA, USA

Lead Electronic Security Engineer, CPP - Federal Facilities - Hybrid

@ Black & Veatch | Denver, CO, US

Profissional Sênior de Compliance & Validação em TI - Montes Claros (MG)

@ Novo Nordisk | Montes Claros, Minas Gerais, BR

Principal Engineer, Product Security Engineering

@ Google | Sunnyvale, CA, USA