23 Aug 2024, 04:24 UTC115 views3 reactionsread 12 August 2026 Event Loop
Один из самых часто задаваемых вопросов на собеседовании на позицию Frontend разработчика, это EventLoop. Нужно рассказать что это такое, из каких строительных блоков состоит и как он работает.
После этого вопроса, как правило могут дать некий код, в котором нужно сказать, в каком порядке будут выведены заданный список из console.log - ов. Это упражнение на понимание Microtasks и Macrotasks.
Вот пример…
👍3
22 Aug 2024, 08:10 UTC139 views5 reactionsread 12 August 2026 structuredClone
Если вам требуется создать глубокую копию объекта в Javascript, то на текущий момент можно воспользоваться встроенным structuredClone методом.
Выглядеть это будет вот так:
const obj = {
a: 1,
b: {
c: 2,
}
};
const clone = structuredClone(obj);
console.log(clone); // { a: 1, b: { c: 2 } }
Больше не нужно писать вручную рекурсивную функцию, которая делает deep clone или использовать метод …
🔥5
20 Jan 2024, 04:30 UTC121 viewsread 12 August 2026 Which accessibility best practices do you know?
I was asked this question in an interview at Reddit. These are the most important points:
- Support keyboard navigation
- Set focus on modals, popovers, alerts
- Use correct HTML5 input types
- Images should have alt descriptions
- Use the lang attribute on the html element
- Use only one h1 tag per page
- Use a description with the title tag
- Use aria landmar…
19 Jan 2024, 10:07 UTC67 viewsread 12 August 2026 Security best practices
- Adding CSRF Token is a critical security measure for protecting web applications from unauthorized data submissions from other websites
- Install SSL Certificate
- Keep all libraries and frameworks up-to-date to avoid vulnerabilities found in older versions.
- Limit User Permissions and Access
- Always validate user input to protect against common vulnerabilities like SQL injection, cross-s…
14 Jan 2024, 04:57 UTC47 viewsread 12 August 2026 Difference between cookie, sessionStorage, and localStorage
Cookie, sessionStorage, and localStorage are all methods used to store data on the client side, but they have different characteristics and use cases:
Cookies
- Capacity: 4KB
- Accessibility: All windows
- Expiration: Manually set
- Passed in HTTP request: Yes
- Storage: Browser and Server
- Use cases: session management, personalization, tracking, and an…
12 Jan 2024, 04:52 UTC48 viewsread 12 August 2026 Describe z-index, and it's stacking context
The z-index property controls the stacking order of elements on a web page.
An element with a greater stack order is always in front of an element with a lower stack order.
The z-index only works in combination with the positioned elements (position: absolute, position, relative, position: fixed, or position: sticky) and flex items.
Without a specified z-index, HTML ele…
11 Jan 2024, 04:08 UTC39 viewsread 12 August 2026 Difference between reset.css and normalize.css
reset.css and normalize.css are CSS files that improve cross-browser consistency in HTML element styling, but they use different approaches.
reset.css
reset.css removes all built-in browser styling. Standard HTML elements like headings, paragraphs, and lists will appear unstyled and look the same in every browser, providing a clean slate for further styling.
This mea…
10 Jan 2024, 12:26 UTC41 viewsread 12 August 2026 Difference between <script>, <script async>, <script defer>
In HTML, the <script> tag is used to embed a JavaScript script in your webpage.
You can modify the behavior of this tag by using the async and defer attributes.
<script>
Script without any attributes is fetched and executed immediately, blocking the parsing of the rest of the HTML document until the script is loaded and executed.
<script async>
The scr…
9 Jan 2024, 03:41 UTC40 viewsread 12 August 2026 Difference between px, rem, em units
There are two types of units in CSS:
- Absolute units: px
- Relative units: em, rem, %, vh
Absolute units don't change, while relative units are flexible and change based on context.
Let's dive into the most popular of them: px, em, and rem.
Pixels (px)
Pixels (PX) are a common unit of measurement in web design. They are fixed and useful for maintaining consistent sizing of…
8 Jan 2024, 04:41 UTC38 viewsread 12 August 2026 How to center a DIV element
How to center a DIV element horizontally and vertically? Name a different approaches.
Let's say that we have the following HTML structure:
<div class="parent">
<div class="child">Centered Content</div>
</div>
Approach 1: Using Flexbox
If the parent container of your div is a flex container, you can center the div both horizontally and vertically with the following CSS:
.parent {
…
7 Jan 2024, 04:23 UTC39 viewsread 12 August 2026 Implement throttle
Throttling is a technique that ensures that the function does not execute more than once in a specified time period.
This is useful for managing the performance of functions that could be triggered frequently.
You are required to implement throttle(fn, delay) decorator function.
Example:
function throttle(fn, delay) {
// Your implementation
}
const print = () => {
console.log("print");
}
…
5 Jan 2024, 04:53 UTC34 viewsread 12 August 2026 Implement Spy decorator
The Decorator is a design pattern that allows you to modify the existing functionality of a function by wrapping it in another function.
In the JavaScript testing framework Jest, a "spy" is typically used to monitor the behavior of a function:
spyOn(object, methodName)
You are required to implement Spy Decorator, which counts how many times the given function was called and with which argu…
Showing the 12 most recent of 20 posts we hold for @zenfrontend. View and reaction counts are the latest single reading for each post, not a live figure, and a recent post is still accumulating both. A view count marked ≈ was rounded by Telegram before we ever saw it — t.me prints views in full below 1,000 and to three significant figures above, so ≈1,200,000 means somewhere between 1,150,000 and 1,249,999. Unmarked counts are exact. Text is reproduced from the public post preview and truncated for length.