1 min readApr 3, 2020
Hello Jeffrey C Dege! thanks for the response,will reply here as well to make it easier visible for other users:
Please note that parsedNumbers
is a JavaScript object not an array. If it was an array you would be correct — the worst case scenario would be iterating through the array to find the value and thus the time complexity would be O(n²).
However, similar to a traditional HashTable, the retrieval of a key’s value from a JS object is in O(1) as explained here.