January 2020
Intermediate to advanced
548 pages
13h 36m
English
One key scarcity that we are always aware of is time. Time is a vital resource that we should seek to only spend with due consideration. In the world of programming, we should seek to optimize the amount of time, or CPU cycles, spent on any given task. This is to be accommodating to our end users, as they themselves have limited time, but also to be prudent with limited and expensive hardware.
Given almost any function in JavaScript, there are ways for it to be written more efficiently and less efficiently. Take, for example, this function, which removes duplicate strings within an array:
function removeDuplicateStrings(array) { const outputArray = []; array.forEach((arrayItem, index) => { // Check if the same item exists ahead of where ...Read now
Unlock full access