"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > What I learned last week (

What I learned last week (

Published on 2024-11-07
Browse:995

What I learned last week (

  1. Reactivity in vanilla JavaScript – use the Proxy pattern to fire events when app state changes. (Frontend Masters course - 'you might not need a framework')

  2. throw new Error("Error!") cannot be used in a ternary (at least not as the 'else' part. The last part of a ternary operator must be an expression, not a function. 'throw' is not an expression, rather it's a statement used to interrupt execution of functions.

  3. A 'stack' in Javascript can be considered a bit like an array, if used in the context of solving problems like you might find on Leetcode. It follows the Last-In-First-Out (LIFO) principle, where elements are added and removed from the same end. Stacks are used to manage function calls, undo functionality etc.

  4. In Javascript any arbitrary number of arguments can be passed to a function. They are accessible via an arguments object which is 'array-like', ie you can use methods such as .length to see how many arguments have been used on the function invocation, for example. (This one is pretty fascinating and well-worth exploring in the console.)

Release Statement This article is reproduced at: https://dev.to/calier/what-i-learned-last-week-3124-56k6?1 If there is any infringement, please contact [email protected] to delete it
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3