| Desktop | Tablet | Mobile |
|---|---|---|
![]() |
![]() |
![]() |
- Estimated: 3 days
- Actual: 5 days
- HTML
- CSS
- JS
-
The
::backdroppseudo-element can be used to style the layer behind a<dialog>element. -
The
window.getComputedStyle()method allows you to get the final computed styles of an element. -
How to use a
Mapin JavaScript. -
When creating multiple promises inside an async function, avoid adding
awaitto each one individually. For example:const promise1 = fetch("url-1").then((r) => r.text()); const promise2 = fetch("url-2").then((r) => r.json()); [data1, data2] = await Promise.all([promise1, promise2]);
The first two lines run immediately, creating promises and attaching handlers. The actual waiting happens in the third line, where
Promise.allresolves all promises together. This approach is more efficient than awaiting each promise separately, since it allows the requests to run in parallel while still giving you full control over the flow. -
Setting
el.style.property = ''removes an inline style property, allowing external CSS to take effect again. Alternatively, you can useel.style.removeProperty('property-name'). -
If you plan to work with promises and asynchronous operations in JavaScript, learning
async/awaitas soon as possible is essential. It provides a much cleaner and more effective way to handle async logic compared to chaining.then()calls. -
When building a program that mixes synchronous and asynchronous actions but needs to follow a clear step-by-step sequence, define a
main()function and make itasync. Insidemain, you can useawaitfor asynchronous functions and call synchronous functions normally. This allows you to structure your program like a narrative—clean and sequential. -
In JavaScript, any function that returns a Promise can be awaited. So you can create helper functions that do some async work and return a promise then
awaitfor that promise to resolve in yourasync mainfunction. -
When styling an open
<dialog>(e.g., a modal), you might set its position toabsoluteorfixedand usetoporbottomto position it—but sometimes this doesn’t work as expected. This is because some browsers apply a defaultinset: 0;(from the user-agent stylesheet) to dialog elements. To fix this, override it by settinginset: unset;, which then allowstopandbottomproperties to work properly.
- Github - @aminforouzan
- Frontend Mentor - @AminForouzan


