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: |

How to Use Bitcoin?

n the U.S. people generally use Bitcoin as an alternative investment, helping diversify a portfolio apart from stocks and bonds. You can also use Bitcoin to make purchases, but the number of vendors that accept the cryptocurrency is still limited. Big companies that accept Bitcoin include Overstock, AT&T and Twitch. You may also find that some small local retailers or certain websites take Bitcoin, but you’ll have to do some digging. That said, PayPal has announced that it will enable cryptocurrency as a funding source for purchases this year, financing purchases by automatically converting crypto holdings to fiat currency for users. β€œThey have 346 million users and they’re connected to 26 million merchants,” says Spencer Montgomery, founder of Uinta Crypto Consulting. β€œIt’s huge.”

Newly uncovered hack campaign in Telegram

The campaign, which security firm Check Point has named Rampant Kitten, comprises two main components, one for Windows and the other for Android. Rampant Kitten’s objective is to steal Telegram messages, passwords, and two-factor authentication codes sent by SMS and then also take screenshots and record sounds within earshot of an infected phone, the researchers said in a post published on Friday.

telegram from sg


Telegram CodeBase | Frontend
FROM USA