Closed pyskell closed 7 years ago
Actually the code works as expected:
modules.length++
increases the size of the array as documentedinput
is assigned to either the newly added last element of the array (in case not found) or to the found location in the array.
At the end of
addModule()
is the following code:modules.length++
will not increase the size of the array and is unnecessary.According to this stackoverflow question you should likely be using
modules.push()
sincemodules
does not have a declared size.