Telegram Group & Telegram Channel
πŸ‘©β€πŸ’» Π§Ρ‚ΠΎ Ρ‚Π°ΠΊΠΎΠ΅ ΠΌΠ΅Ρ‚ΠΎΠ΄ map() Π² JavaScript ΠΈ ΠΊΠ°ΠΊ ΠΎΠ½ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ?

map() β€” это ΠΌΠ΅Ρ‚ΠΎΠ΄ массивов Π² JavaScript, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ создаёт Π½ΠΎΠ²Ρ‹ΠΉ массив, прСобразуя ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ элСмСнт исходного массива ΠΏΠΎ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ.
Π˜ΡΡ…ΠΎΠ΄Π½Ρ‹ΠΉ массив Π½Π΅ измСняСтся.

➑️ ΠŸΡ€ΠΈΠΌΠ΅Ρ€:

const numbers = [1, 2, 3, 4, 5];

// Π£ΠΌΠ½ΠΎΠΆΠ°Π΅ΠΌ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ элСмСнт Π½Π° 2
const doubled = numbers.map(num => num * 2);

console.log(doubled); // [2, 4, 6, 8, 10]


πŸ—£οΈ Π’ этом ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π΅:

β€’ map() примСняСт Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΊΠΎ всСм элСмСнтам массива
β€’ Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ Π½ΠΎΠ²Ρ‹ΠΉ массив с Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Π°ΠΌΠΈ
β€’ ИдСалСн для прСобразования Π΄Π°Π½Π½Ρ‹Ρ… (Π½Π°ΠΏΡ€ΠΈΠΌΠ΅Ρ€, ΡƒΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅, Ρ„ΠΎΡ€ΠΌΠ°Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅).

CodeBase | Frontend | #JS
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/codebase_frontend/651
Create:
Last Update:

πŸ‘©β€πŸ’» Π§Ρ‚ΠΎ Ρ‚Π°ΠΊΠΎΠ΅ ΠΌΠ΅Ρ‚ΠΎΠ΄ map() Π² JavaScript ΠΈ ΠΊΠ°ΠΊ ΠΎΠ½ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ?

map() β€” это ΠΌΠ΅Ρ‚ΠΎΠ΄ массивов Π² JavaScript, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ создаёт Π½ΠΎΠ²Ρ‹ΠΉ массив, прСобразуя ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ элСмСнт исходного массива ΠΏΠΎ Π·Π°Π΄Π°Π½Π½ΠΎΠΉ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ.
Π˜ΡΡ…ΠΎΠ΄Π½Ρ‹ΠΉ массив Π½Π΅ измСняСтся.

➑️ ΠŸΡ€ΠΈΠΌΠ΅Ρ€:

const numbers = [1, 2, 3, 4, 5];

// Π£ΠΌΠ½ΠΎΠΆΠ°Π΅ΠΌ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ элСмСнт Π½Π° 2
const doubled = numbers.map(num => num * 2);

console.log(doubled); // [2, 4, 6, 8, 10]


πŸ—£οΈ Π’ этом ΠΏΡ€ΠΈΠΌΠ΅Ρ€Π΅:

β€’ map() примСняСт Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΊΠΎ всСм элСмСнтам массива
β€’ Π’ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅Ρ‚ Π½ΠΎΠ²Ρ‹ΠΉ массив с Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚Π°ΠΌΠΈ
β€’ ИдСалСн для прСобразования Π΄Π°Π½Π½Ρ‹Ρ… (Π½Π°ΠΏΡ€ΠΈΠΌΠ΅Ρ€, ΡƒΠΌΠ½ΠΎΠΆΠ΅Π½ΠΈΠ΅, Ρ„ΠΎΡ€ΠΌΠ°Ρ‚ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅).

CodeBase | Frontend | #JS

BY CodeBase | Frontend


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/codebase_frontend/651

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

Dump Scam in Leaked Telegram Chat

A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless β€œ$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

telegram from us


Telegram CodeBase | Frontend
FROM USA