Sunday, May 7, 2023

122: JS Challenge 3

 Today's Leetcode challenge asked you to make a function that returns an object. This object has three simple methods that increment, decrement, and reset a variable that is passed as an argument when the object is instantiated. I chose to do this by declaring the three functions within the body of the outer function, along with a counter variable initially set to equal the initializer variable. An object is then returned, with its keys defined as the names of the functions and the values set to those functions. Objects in JS can be returned using the curly brace notation.

No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...