fixed numerous spelling errors
This commit is contained in:
@ -10,7 +10,7 @@ excerpt: VS Code is steadily gaining popularity among developers. Here are 10 es
|
||||
Developers will most likely argue for the rest of eternity about the most productive code editor and the best extensions. Here are my personal extension preferences for VS Code as a JavaScript developer:
|
||||
|
||||
1. ESLint
|
||||
[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) turns the popular JavaScrpt linter into an extension of VS Code. It automatically reads your linting configuration, identifies problems and even fixes them for you, if you want.
|
||||
[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) turns the popular JavaScript linter into an extension of VS Code. It automatically reads your linting configuration, identifies problems and even fixes them for you, if you want.
|
||||
|
||||
2. GitLens
|
||||
[GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens) is a very powerful collaboration tool for VS Code. It provides many useful tools for git such as blame, code authorship, activity heatmaps, recent changes, file history and even commit search.
|
||||
|
||||
@ -29,6 +29,6 @@ Any kind of `<input>` element should be labelled appropriately, using either a `
|
||||
Responsiveness is often thought in terms of screen size or mobile vs desktop, but there are many different devices where a user could browse your website. Try catering to any and all of them by providing ways to navigate and use your application via mouse, keyboard, thumb or any combination of the three.
|
||||
|
||||
8. Organize your content
|
||||
A website's layout should be easy to scan, understand and find the content that is relevant to the user. Good organization with clear sections and properly groupped content provides a better user experience for all users, regardless of device or accessibility needs.
|
||||
A website's layout should be easy to scan, understand and find the content that is relevant to the user. Good organization with clear sections and properly grouped content provides a better user experience for all users, regardless of device or accessibility needs.
|
||||
|
||||
**Image credit:** [AbsolutVision](https://unsplash.com/@freegraphictoday?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
|
||||
|
||||
@ -13,7 +13,7 @@ Working from home (also known as remote work) seems like a great alternative to
|
||||
Working from home has its perks, but nothing beats a well-designed office space where everything is set up with only one purpose in mind: working. Figure out your home office, experiment with different settings and understand what works best for you as soon as possible. An ideal working space is comfortable, quiet and has the right equipment for you.
|
||||
|
||||
2. Establish ground rules
|
||||
Most likely you are not living alone, so you have to establish some ground rules with your roomate or significant other. It's up to you to drive the point home that during working hours you are, for the most part, not home. Sure, you can answer the door if you expect a delivery, but that's pretty much as far as you can go. People should not bother you during working hours, unless absolutely necessary, as small distractions pile up fast.
|
||||
Most likely you are not living alone, so you have to establish some ground rules with your roommate or significant other. It's up to you to drive the point home that during working hours you are, for the most part, not home. Sure, you can answer the door if you expect a delivery, but that's pretty much as far as you can go. People should not bother you during working hours, unless absolutely necessary, as small distractions pile up fast.
|
||||
|
||||
3. Inform others of your availability
|
||||
It's important to let people know that you are online and working or that you are taking a short break for lunch. Remember that you are still part of a team that requires coordination and others probably depend on your work to some extent. Remember to update your status as necessary to make collaboration easier.
|
||||
@ -22,7 +22,7 @@ It's important to let people know that you are online and working or that you ar
|
||||
Working from home can lead to feelings of loneliness, disconnect, isolation which can quickly spin out of control and lead to depression. Communicate with people on your team as if you were in the same room. A healthy amount of communication will help you feel more like you are all working together rather than each one on their own.
|
||||
|
||||
5. Be your best professional self
|
||||
Nobody might be watching you at home, so you can theoretically slack off as much as you like in your pajamas, but that's not very professional. Try to dress appropriately in case you join a video call and behave professionaly, so no inappropriate websites or hours upon hours of checking social media. Ask yourself if someone in a shared office space would do whatever it is you are doing and, if the answer is no, stop doing it.
|
||||
Nobody might be watching you at home, so you can theoretically slack off as much as you like in your pajamas, but that's not very professional. Try to dress appropriately in case you join a video call and behave professionally, so no inappropriate websites or hours upon hours of checking social media. Ask yourself if someone in a shared office space would do whatever it is you are doing and, if the answer is no, stop doing it.
|
||||
|
||||
6. Plan your daily and weekly tasks
|
||||
Having a coherent working plan helps you organize your time and prioritize important tasks above trivial ones. It also helps to put things into perspective and have a general idea of what other people on the team are working on. Plan ahead of time together with your team and keep each other posted on the progress of each task. Short term plans help you get through the day, long term plans help everyone meet their deadlines.
|
||||
|
||||
@ -9,8 +9,8 @@ excerpt: Learn everything you need to know about promises and asynchronous JavaS
|
||||
|
||||
### Promise basics
|
||||
|
||||
- **Promises** start in a **pending state**, neither fullfiled or rejected.
|
||||
- When the operation is completed, a promise will become **fullfiled with a value**.
|
||||
- **Promises** start in a **pending state**, neither fulfilled or rejected.
|
||||
- When the operation is completed, a promise will become **fulfilled with a value**.
|
||||
- If the operation fails, a promise will get **rejected with an error**.
|
||||
|
||||
### Creating promises
|
||||
@ -72,7 +72,7 @@ promisedOperation()
|
||||
|
||||
- `Promise.all()` turns an array of promises into a promise of an array.
|
||||
- If any promise is rejected, the error will pass through.
|
||||
- `Promise.race()` passes throuh the first settled promise.
|
||||
- `Promise.race()` passes through the first settled promise.
|
||||
|
||||
```js
|
||||
Promise
|
||||
|
||||
@ -89,7 +89,7 @@ fibonacciNumber(4);
|
||||
// [CALC] Computed and stored value for 4: 3
|
||||
```
|
||||
|
||||
As you can see in the example above, the value for each `n` is only computed once. While the Fibonacci sequence doesn't require any costly calculations, this could make a huge difference for a more computationally expensive problem. It will also be a lot more noticable for higher values of `n` where the number of calculations will increase singificantly.
|
||||
As you can see in the example above, the value for each `n` is only computed once. While the Fibonacci sequence doesn't require any costly calculations, this could make a huge difference for a more computationally expensive problem. It will also be a lot more noticeable for higher values of `n` where the number of calculations will increase significantly.
|
||||
|
||||
### Using iteration
|
||||
|
||||
@ -114,7 +114,7 @@ fibonacciNumber(4);
|
||||
// [CALC] i = 3: r = 1, l = 2, s = 3
|
||||
```
|
||||
|
||||
The iterative solution above makes the same calculations as the memoized one, however it performas better due to two key reasons. First of all, there is no cache, which would take up space in memory, making the latter implementation require fewer resources. Similarly, as there are no recursive calls or checks for cache hits, the code performs better and requires fewer resources to execute.
|
||||
The iterative solution above makes the same calculations as the memoized one, however it performs better due to two key reasons. First of all, there is no cache, which would take up space in memory, making the latter implementation require fewer resources. Similarly, as there are no recursive calls or checks for cache hits, the code performs better and requires fewer resources to execute.
|
||||
|
||||
However, you have to bear in mind what the actual use cases of your recursive code are and be very careful how you optimize them. Memoization can be a more powerful tool if a recursive function is called multiple times with different arguments, as its cache persists between calls, while iteration can be faster for recursive computations that are used less frequently. Always pay attention to your code and optimize for the cases you know or anticipate to be more common.
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ Cookies store small amounts of data that has to be sent back to the server with
|
||||
|
||||
### Local storage
|
||||
|
||||
Local storage stores a larger amount of data on the client's computer in a key-value pair format and has no expiration date. Data is never transferred to the server and is accesible via JavaScript and HTML5.
|
||||
Local storage stores a larger amount of data on the client's computer in a key-value pair format and has no expiration date. Data is never transferred to the server and is accessible via JavaScript and HTML5.
|
||||
|
||||
- Capacity: 10MB
|
||||
- Accessible from: Any window
|
||||
|
||||
@ -7,7 +7,7 @@ cover: blog_images/orange-flower.jpg
|
||||
excerpt: Learn how to use CSS pseudo-classes to style an element based on changes to its state.
|
||||
---
|
||||
|
||||
CSS pseudo-classes provide a way to style elements, based on changes to their state. For example, `:hover` can be used to apply additiona styles to an element when the user's pointer hovers over it.
|
||||
CSS pseudo-classes provide a way to style elements, based on changes to their state. For example, `:hover` can be used to apply additional styles to an element when the user's pointer hovers over it.
|
||||
|
||||
Pseudo-classes let you apply styles to elements in relation to the content of the document tree (e.g. `:first-child`), external factors such as the history of the navigator (e.g. `:visited`), the status of their content (e.g. `:checked`) or the position of the mouse (e.g. `:hover`).
|
||||
|
||||
|
||||
@ -21,6 +21,6 @@ Co-authored-by: another-name <another-name@example.com>"
|
||||
|
||||
- To correctly attribute a commit to a co-author, you must use the email associated with their GitHub account.
|
||||
- If a person's email is private, you can use their GitHub-provided `no-reply` email.
|
||||
- Leave one or preferrably two empty lines before any `Co-authored-by` trailers.
|
||||
- Leave one or preferably two empty lines before any `Co-authored-by` trailers.
|
||||
|
||||
**Image credit:** [Taylor Simpson](https://unsplash.com/@taylorgsimpson?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
|
||||
|
||||
@ -9,7 +9,7 @@ excerpt: Learn the differences between JavaScript ES6 arrow functions and regula
|
||||
|
||||
### Arrow functions
|
||||
|
||||
JavaScript ES6 introduced the concept of arrow functions, a new way to define and write functions. While they might seem like a syntactic sugar on top of regular functions, they have a key difference which lies in the way the `this` context is bound. I will not go into a lot of detail in this article, however I strongly suggest you read [Understanding the "this" keyword in JavaScript](/blog/s/javascript-this) before continuing. To summarize what the afforementioned blog post explains in more detail:
|
||||
JavaScript ES6 introduced the concept of arrow functions, a new way to define and write functions. While they might seem like a syntactic sugar on top of regular functions, they have a key difference which lies in the way the `this` context is bound. I will not go into a lot of detail in this article, however I strongly suggest you read [Understanding the "this" keyword in JavaScript](/blog/s/javascript-this) before continuing. To summarize what the aforementioned blog post explains in more detail:
|
||||
|
||||
> Arrow functions do not have their own bindings for `this`, resulting in `this` retaining the value of the enclosing lexical context's `this`.
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ excerpt: Naming conventions, while not easy to enforce, make code easier to read
|
||||
|
||||
- Names are case-sensitive, lowercase and uppercase are different.
|
||||
- Start class names with a capital letter, use `PascalCase` for names.
|
||||
- Use descriptive names, explaining the funcionality of the class.
|
||||
- Use descriptive names, explaining the functionality of the class.
|
||||
- Components, which are used in frontend frameworks follow the same rules.
|
||||
|
||||
### Private
|
||||
|
||||
@ -38,7 +38,7 @@ Apart from cleaner code, this operator might spare us some headaches related to
|
||||
```js
|
||||
const config = getServerConfig();
|
||||
|
||||
// Without nullish coallescing
|
||||
// Without nullish coalescing
|
||||
const port = config.server.port || 8888;
|
||||
// Oops! This will be true even if we pass it false
|
||||
const wrongkeepAlive = config.server.keepAlive || true;
|
||||
@ -47,7 +47,7 @@ const keepAlive =
|
||||
(config.server.keepAlive !== null & config.server.keepAlive !== undefined)
|
||||
? config.server.keepAlive : true;
|
||||
|
||||
// With nullish coallescing
|
||||
// With nullish coalescing
|
||||
const port = config.server.port ?? 8888;
|
||||
// This works correctly
|
||||
const keepAlive = config.server.keepAlive ?? true;
|
||||
|
||||
@ -9,7 +9,7 @@ excerpt: One of the most commonly asked JavaScript interview questions is about
|
||||
|
||||
Before your JavaScript code is executed, it is first parsed and compiled. During the _compile_ phase, variable and function declarations are put into memory, which is called **hoisting**.
|
||||
|
||||
Note that only declarations are hoisted, not initializations, meaning that if a variable is declared and initialized after using it, its value will not be initialized. This is an oversimplificatin of the situation, so let's take a look at the different cases:
|
||||
Note that only declarations are hoisted, not initializations, meaning that if a variable is declared and initialized after using it, its value will not be initialized. This is an oversimplification of the situation, so let's take a look at the different cases:
|
||||
|
||||
### function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user