Функции высшего порядка в JavaScript: руководство

–ö–∞–∫ —Ä–∞–∑—Ä–∞–±–æ—Ç—á–∏–∫, –≤—ã, –≤–µ—Ä–æ—è—Ç–Ω–æ, –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–ª–∏ –æ–±—ã—á–Ω—ã–µ —Ñ—É–Ω–∫—Ü–∏–∏ JavaScript. –í—ã–∑—ã–≤–∞—é—Ç—Å—è —Ñ—É–Ω–∫—Ü–∏—è–º–∏ –ø–µ—Ä–≤–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞, & nbsp; –æ–Ω–∏ –Ω–µ –ø—Ä–∏–Ω–∏–º–∞—é—Ç —Ñ—É–Ω–∫—Ü–∏—é –≤ –∫–∞—á–µ—Å—Ç–≤–µ –ø–∞—Ä–∞–º–µ—Ç—Ä–∞ –∏ –Ω–µ –≤–æ–∑–≤—Ä–∞—â–∞—é—Ç —Ñ—É–Ω–∫—Ü–∏—é.

–í —ç—Ç–æ–π —Å—Ç–∞—Ç—å–µ —Ä–∞—Å—Å–∫–∞–∑—ã–≤–∞–µ—Ç—Å—è –æ —Ñ—É–Ω–∫—Ü–∏—è—Ö –±–æ–ª–µ–µ –≤—ã—Å–æ–∫–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞ (HOF). –≠—Ç–æ —Ñ—É–Ω–∫—Ü–∏–∏, –∫–æ—Ç–æ—Ä—ã–µ –ø–æ–º–æ–≥–∞—é—Ç —Ä–∞–∑—Ä–∞–±–æ—Ç—á–∏–∫–∞–º —Å–æ–∫—Ä–∞—Ç–∏—Ç—å –∫–æ–¥, —á—Ç–æ–±—ã —Å–¥–µ–ª–∞—Ç—å –µ–≥–æ –±–æ–ª–µ–µ —á–∏—Ç–∞–µ–º—ã–º, –ø–µ—Ä–µ–¥–∞–≤ —Ñ—É–Ω–∫—Ü–∏—é –≤ –∫–∞—á–µ—Å—Ç–≤–µ –∞—Ä–≥—É–º–µ–Ω—Ç–∞ –∏–ª–∏ –≤–æ–∑–≤—Ä–∞—â–∞—è —Ñ—É–Ω–∫—Ü–∏—é. –ú—ã —Ä–∞—Å—Å–º–æ—Ç—Ä–∏–º –Ω–µ—Å–∫–æ–ª—å–∫–æ –±–∞–∑–æ–≤—ã—Ö –ø—Ä–∏–º–µ—Ä–æ–≤, —á—Ç–æ–±—ã –ø–æ–∑–Ω–∞–∫–æ–º–∏—Ç—å –≤–∞—Å —Å HOF –∏ —Ñ—É–Ω–∫—Ü–∏–æ–Ω–∞–ª—å–Ω—ã–º –ø—Ä–æ–≥—Ä–∞–º–º–∏—Ä–æ–≤–∞–Ω–∏–µ–º, –∏ –ø–æ–≥–æ–≤–æ—Ä–∏–º –æ –¥–≤—É—Ö –ø–æ–ø—É–ª—è—Ä–Ω—ã—Ö —Ä–∞—Å—à–∏—Ä–µ–Ω–Ω—ã—Ö –º–µ—Ç–æ–¥–∞—Ö —Ä–∞–±–æ—Ç—ã —Å –º–∞—Å—Å–∏–≤–∞–º–∏, –∫–æ—Ç–æ—Ä—ã–µ –∏—Å–ø–æ–ª—å–∑—É—é—Ç –∫–æ–Ω—Å—Ç—Ä—É–∫—Ü–∏—é —Ñ—É–Ω–∫—Ü–∏–π –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞ –¥–ª—è —Ä–∞–±–æ—Ç—ã.

–û—Å–Ω–æ–≤–Ω—ã–µ –ø—Ä–∏–º–µ—Ä—ã —Ñ—É–Ω–∫—Ü–∏–π –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞

–°—É—â–µ—Å—Ç–≤—É–µ—Ç –Ω–µ—Å–∫–æ–ª—å–∫–æ —Ä–∞–∑–ª–∏—á–Ω—ã—Ö —Å–ø–æ—Å–æ–±–æ–≤ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏—è —Ñ—É–Ω–∫—Ü–∏–π –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞ –≤ JavaScript.

–ö–∞–ª—å–∫—É–ª—è—Ç–æ—Ä

–î–∞–≤–∞–π—Ç–µ –Ω–∞—á–Ω–µ–º —Å –±–∞–∑–æ–≤–æ–≥–æ HOF, –∫–æ—Ç–æ—Ä—ã–π –ø—Ä–∏–Ω–∏–º–∞–µ—Ç —Ñ—É–Ω–∫—Ü–∏—é –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞ –≤ –∫–∞—á–µ—Å—Ç–≤–µ –∞—Ä–≥—É–º–µ–Ω—Ç–∞. –∏ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç —ç—Ç–æ—Ç –æ–±—Ä–∞—Ç–Ω—ã–π –≤—ã–∑–æ–≤ —Å –Ω–µ–∫–æ—Ç–æ—Ä—ã–º–∏ –∞—Ä–≥—É–º–µ–Ω—Ç–∞–º–∏: & nbsp;

–ó–¥–µ—Å—å —É –Ω–∞—Å –µ—Å—Ç—å –¥–≤–∞ —Ç–∏–ø–∞ —Ñ—É–Ω–∫—Ü–∏–π: —Ñ—É–Ω–∫—Ü–∏—è –±–æ–ª–µ–µ –≤—ã—Å–æ–∫–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞, –∫–æ—Ç–æ—Ä–∞—è –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –æ–±—Ä–∞—Ç–Ω—ã–π –≤—ã–∑–æ–≤, –∏ —Ñ—É–Ω–∫—Ü–∏—è —É—Å—Ç–∞–Ω–æ–≤–∫–∏ –ø–µ—Ä–≤–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞, –∫–æ—Ç–æ—Ä–∞—è –≤—ã–ø–æ–ª–Ω—è–µ—Ç –æ–ø–µ—Ä–∞—Ü–∏—è –Ω–∞–¥ –¥–≤—É–º—è —á–∏—Å–ª–∞–º–∏. –í –∫–æ–Ω—Ü–µ —Ñ—Ä–∞–≥–º–µ–Ω—Ç–∞ –º—ã –≤—ã–∑—ã–≤–∞–µ–º —Ñ—É–Ω–∫—Ü–∏—é upperOrderFunction (). –≠—Ç–∞ —Ñ—É–Ω–∫—Ü–∏—è –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç —Ä–µ–∑—É–ª—å—Ç–∞—Ç –≤—ã–∑–æ–≤–∞ cb, –ø–µ—Ä–µ–¥–∞–Ω–Ω–æ–≥–æ —Å –∑–∞–¥–∞–Ω–Ω—ã–º–∏ –ø–∞—Ä–∞–º–µ—Ç—Ä–∞–º–∏. –ï—Å–ª–∏ –≤—ã –Ω–∞–ø–∏—Å–∞–ª–∏ —Ñ—É–Ω–∫—Ü–∏—é –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞ –¥–ª—è –≤—Å–µ—Ö –≤–æ–∑–º–æ–∂–Ω—ã—Ö –∞—Ä–∏—Ñ–º–µ—Ç–∏—á–µ—Å–∫–∏—Ö –æ–ø–µ—Ä–∞—Ç–æ—Ä–æ–≤, –≤—ã –º–æ–∂–µ—Ç–µ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å —Ñ—É–Ω–∫—Ü–∏—é upperOrderFunction –¥–ª—è –≤—ã–∑–æ–≤–∞ –ª—é–±–æ–π –Ω—É–∂–Ω–æ–π –æ–ø–µ—Ä–∞—Ü–∏–∏.

–°–ª—É—à–∞—Ç–µ–ª—å —Å–æ–±—ã—Ç–∏–π

–î—Ä—É–≥–æ–π –ø—Ä–∏–º–µ—Ä —Ñ—É–Ω–∫—Ü–∏–∏ –±–æ–ª–µ–µ –≤—ã—Å–æ–∫–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞ - —ç—Ç–æ —Ç–æ, —á—Ç–æ –ø—Ä–æ–∏—Å—Ö–æ–¥–∏—Ç, –∫–æ–≥–¥–∞ –≤—ã –¥–æ–±–∞–≤–ª—è–µ—Ç–µ –ø—Ä–æ—Å–ª—É—à–∏–≤–∞—Ç–µ–ª—å —Å–æ–±—ã—Ç–∏–π –∫ —ç–ª–µ–º–µ–Ω—Ç—É –≤ DOM (–æ–±—ä–µ–∫—Ç–Ω–∞—è –º–æ–¥–µ–ª—å –¥–æ–∫—É–º–µ–Ω—Ç–∞). –í–æ–∑—å–º–∏—Ç–µ —Å–ª–µ–¥—É—é—â–∏–π –ø—Ä–∏–º–µ—Ä: & nbsp;

–í —ç—Ç–æ–º –ø—Ä–∏–º–µ—Ä–µ —è —Å–æ–∑–¥–∞–ª –∫–Ω–æ–ø–∫—É –≤ HTML, –≤—ã–¥–µ–ª–∏–ª –µ–µ —Å –ø–æ–º–æ—â—å—é JavaScript –∏ –¥–æ–±–∞–≤–∏–ª –∫ –Ω–µ–π –ø—Ä–æ—Å–ª—É—à–∏–≤–∞—Ç–µ–ª—å —Å–æ–±—ã—Ç–∏–π. –ü–æ —Å—Ç—Ä—É–∫—Ç—É—Ä–µ –ø—Ä–æ—Å–ª—É—à–∏–≤–∞—Ç–µ–ª—å —Å–æ–±—ã—Ç–∏–π –ø—Ä–µ–¥—Å—Ç–∞–≤–ª—è–µ—Ç —Å–æ–±–æ–π –ø—Ä–æ—Å—Ç—É—é —Ñ—É–Ω–∫—Ü–∏—é –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞ & ndash; –æ–Ω–∞ –ø—Ä–∏–Ω–∏–º–∞–µ—Ç –≤ –∞–Ω–æ–Ω–∏–º–Ω–æ–π —Ñ—É–Ω–∫—Ü–∏–∏ –≤ –∫–∞—á–µ—Å—Ç–≤–µ –≤—Ç–æ—Ä–æ–≥–æ –∞—Ä–≥—É–º–µ–Ω—Ç–∞.
<—Ü–∏—Ñ—Ä–∞ –∫–ª–∞—Å—Å–∞ = "–†–ì-–±–ª–æ–∫-–∏–∑–æ–±—Ä–∞–∂–µ–Ω–∏—è">  –í—ã–¥–µ–ª–µ–Ω–Ω–∞—è –æ–±–ª–∞—Å—Ç—å, –∫–æ—Ç–æ—Ä–∞—è –ø–æ–∫–∞–∑—ã–≤–∞–µ—Ç, –≥–¥–µ –Ω–∞—Ö–æ–¥–∏—Ç—Å—è —Ñ—É–Ω–∫—Ü–∏—è –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞ –≤ –ø—Ä–æ—Å–ª—É—à–∏–≤–∞—Ç–µ–ª–µ —Å–æ–±—ã—Ç–∏–π.

–í—ã–¥–µ–ª–µ–Ω–Ω—ã–π —Ä–∞–∑–¥–µ–ª - –≤–∞—à–∞ —Ñ—É–Ω–∫—Ü–∏—è –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞.

81% —É—á–∞—Å—Ç–Ω–∏–∫–æ–≤ –∑–∞—è–≤–∏–ª–∏, —á—Ç–æ –æ–Ω–∏ –ø–æ—Å–ª–µ –±—É—Ç–∫–µ–º–ø–∞ –ø–æ—á—É–≤—Å—Ç–≤–æ–≤–∞–ª–∏ —Å–µ–±—è –±–æ–ª–µ–µ —É–≤–µ—Ä–µ–Ω–Ω–æ –≤ —Å–≤–æ–∏—Ö –ø–µ—Ä—Å–ø–µ–∫—Ç–∏–≤–∞—Ö —Ç—Ä—É–¥–æ—É—Å—Ç—Ä–æ–π—Å—Ç–≤–∞ –≤ —Å—Ñ–µ—Ä–µ –≤—ã—Å–æ–∫–∏—Ö —Ç–µ—Ö–Ω–æ–ª–æ–≥–∏–π. –ü—Ä–æ–π–¥–∏—Ç–µ —É—á–µ–±–Ω—ã–π –∫—É—Ä—Å —Å–µ–≥–æ–¥–Ω—è.

–°—Ä–µ–¥–Ω–∏–π –≤—ã–ø—É—Å–∫–Ω–∏–∫ —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è –ø–æ—Ç—Ä–∞—Ç–∏–ª –º–µ–Ω–µ–µ —à–µ—Å—Ç–∏ –º–µ—Å—è—Ü–µ–≤ –Ω–∞ —Å–º–µ–Ω—É –∫–∞—Ä—å–µ—Ä—ã, –æ—Ç –Ω–∞—á–∞–ª–∞ —É—á–µ–±–Ω–æ–≥–æ –ª–∞–≥–µ—Ä—è –¥–æ –ø–æ–∏—Å–∫–∞ —Å–≤–æ–µ–π –ø–µ—Ä–≤–æ–π —Ä–∞–±–æ—Ç—ã.

–ú–µ—Ç–æ–¥—ã –≤—Å—Ç—Ä–æ–µ–Ω–Ω–æ–≥–æ –º–∞—Å—Å–∏–≤–∞ JavaScript —ç—Ç–æ —Ç–µ —Å–ø–µ—Ü–∏–∞–ª—å–Ω—ã–µ —Ñ—É–Ω–∫—Ü–∏–∏ –±–æ–ª–µ–µ –≤—ã—Å–æ–∫–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞, –Ω–æ–≤—ã–µ –¥–ª—è ES6, –∫–æ—Ç–æ—Ä—ã–µ –º—ã –º–æ–∂–µ–º –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –¥–ª—è –∏—Ç–µ—Ä–∞—Ü–∏–∏ –ø–æ –º–∞—Å—Å–∏–≤—É –∏ –ª–∏–±–æ –º–∞–Ω–∏–ø—É–ª–∏—Ä–æ–≤–∞—Ç—å –∏–º, –ª–∏–±–æ –≤–æ–∑–≤—Ä–∞—â–∞—Ç—å —Å–æ–≤–µ—Ä—à–µ–Ω–Ω–æ –Ω–æ–≤—ã–π –º–∞—Å—Å–∏–≤, –∑–Ω–∞—á–µ–Ω–∏—è –∫–æ—Ç–æ—Ä–æ–≥–æ –±—ã–ª–∏ –∏–∑–º–µ–Ω–µ–Ω—ã. & nbsp;

–ü–æ –º–µ—Ä–µ —Ç–æ–≥–æ, –∫–∞–∫ –º—ã –Ω–∞—á–∏–Ω–∞–µ–º –ø–æ–ª—É—á–∞—Ç—å –ß—Ç–æ–±—ã –ø–µ—Ä–µ–π—Ç–∏ –∫ –±–æ–ª–µ–µ —Å–ª–æ–∂–Ω–æ–º—É —Ä–µ—à–µ–Ω–∏—é –ø—Ä–æ–±–ª–µ–º –≤ JavaScript, –Ω–∞—á–Ω–∏—Ç–µ –¥—É–º–∞—Ç—å –æ–± –∞–±—Å—Ç—Ä–∞–≥–∏—Ä–æ–≤–∞–Ω–∏–∏ –Ω–µ–∫–æ—Ç–æ—Ä–æ–π –ª–æ–≥–∏–∫–∏, –∫–æ—Ç–æ—Ä—É—é –º—ã –ø–∏—à–µ–º, –∫–æ–≥–¥–∞ –ø–µ—Ä–µ–±–∏—Ä–∞–µ–º –º–∞—Å—Å–∏–≤—ã. –ò—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ —ç—Ç–∏—Ö –º–µ—Ç–æ–¥–æ–≤ –º–∞—Å—Å–∏–≤–∞ —Ñ—É–Ω–∫—Ü–∏–π –±–æ–ª–µ–µ –≤—ã—Å–æ–∫–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞ –ø–æ–º–æ–∂–µ—Ç –≤–∞–º —Å—Ç–∞—Ç—å –ª—É—á—à–∏–º —Ä–∞–∑—Ä–∞–±–æ—Ç—á–∏–∫–æ–º JS.

–î–æ–ø—É—Å—Ç–∏–º, –Ω–∞–ø—Ä–∏–º–µ—Ä, —É –Ω–∞—Å –µ—Å—Ç—å —Ä—è–¥ –ø—Ä–æ—Ñ–µ—Å—Å–æ—Ä–æ–≤:

UVNRam00sqZ2XWlWgK36aj3tP7oHL2i1wM3JLEDbcqwXs IBMxRNlmbknHgjO JFy32VHF7u4glA1btMETcPhCPyoZ0GuToxG0D7MlPWlNMaWsRUNJtkMRNP4kPAYBdORaCwWiRF <—Ä>

Foreach

–ï—Å–ª–∏ –º—ã —Ö–æ—Ç–∏–º –ø–µ—Ä–µ–±—Ä–∞—Ç—å –º–∞—Å—Å–∏–≤ –∏ –º–∞–Ω–∏–ø—É–ª–∏—Ä–æ–≤–∞—Ç—å –∫–∞–∂–¥—ã–º —ç–ª–µ–º–µ–Ω—Ç–æ–º –ø–µ—Ä–µ–¥ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞–Ω–∏–µ–º ES6, –º—ã –¥–æ–ª–∂–Ω—ã —Å–¥–µ–ª–∞—Ç—å —Å–ª–µ–¥—É—é—â–µ–µ:

–°–∏–Ω—Ç–∞–∫—Å–∏—Å ES6 –ø–æ–∑–≤–æ–ª—è–µ—Ç –Ω–∞–º —Å–æ–∫—Ä–∞—Ç–∏—Ç—å –∫–æ–¥, –∏—Å–ø–æ–ª—å–∑—É—è –º–µ—Ç–æ–¥ forEach:

–≠—Ç–æ—Ç –º–µ—Ç–æ–¥ forEach –ø—Ä–∏–Ω–∏–º–∞–µ—Ç —Ñ—É–Ω–∫—Ü–∏—é –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞ –≤ –∫–∞—á–µ—Å—Ç–≤–µ –ø–µ—Ä–≤–æ–≥–æ –ø–∞—Ä–∞–º–µ—Ç—Ä–∞, —á—Ç–æ–±—ã —Å–¥–µ–ª–∞—Ç—å –µ–µ —Ñ—É–Ω–∫—Ü–∏–µ–π –±–æ–ª–µ–µ –≤—ã—Å–æ–∫–æ–≥–æ –ø–æ—Ä—è–¥–∫–∞. –≠—Ç–∞ —Ñ—É–Ω–∫—Ü–∏—è –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞ –ø–æ —Å—É—Ç–∏ —è–≤–ª—è–µ—Ç—Å—è " –¥–µ–π—Å—Ç–≤–∏–µ–º " –≤—ã–ø–æ–ª–Ω—è–µ—Ç—Å—è –¥–ª—è –∫–∞–∂–¥–æ–≥–æ —ç–ª–µ–º–µ–Ω—Ç–∞ –≤ –º–∞—Å—Å–∏–≤–µ. –ö—Ä–æ–º–µ —Ç–æ–≥–æ, –º–µ—Ç–æ–¥ forEach —Ç–∞–∫–∂–µ –ø—Ä–∏–Ω–∏–º–∞–µ—Ç –∏–Ω–¥–µ–∫—Å –∏ –º–∞—Å—Å–∏–≤ –≤ –∫–∞—á–µ—Å—Ç–≤–µ –Ω–µ–æ–±—è–∑–∞—Ç–µ–ª—å–Ω—ã—Ö –≤—Ç–æ—Ä–æ–≥–æ –∏ —Ç—Ä–µ—Ç—å–µ–≥–æ –ø–∞—Ä–∞–º–µ—Ç—Ä–æ–≤. & Nbsp;

–ü–æ—Ä—è–¥–æ–∫ –∏–º–µ–µ—Ç –∑–Ω–∞—á–µ–Ω–∏–µ –¥–ª—è —ç—Ç–∏—Ö –ø–∞—Ä–∞–º–µ—Ç—Ä–æ–≤ –≤ –º–µ—Ç–æ–¥–µ forEach (–∞ —Ç–∞–∫–∂–µ –≤ –¥—Ä—É–≥–∏—Ö –≤—Å—Ç—Ä–æ–µ–Ω–Ω—ã—Ö -–≤ –º–µ—Ç–æ–¥–∞—Ö –º–∞—Å—Å–∏–≤–∞). –ü–µ—Ä–≤—ã–π –≤—Å–µ–≥–¥–∞ —è–≤–ª—è–µ—Ç—Å—è —Ñ—É–Ω–∫—Ü–∏–µ–π –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞, –≤—Ç–æ—Ä–æ–π –≤—Å–µ–≥–¥–∞ —è–≤–ª—è–µ—Ç—Å—è –∏–Ω–¥–µ–∫—Å–æ–º —ç–ª–µ–º–µ–Ω—Ç–∞ –≤ –º–∞—Å—Å–∏–≤–µ, –∞ —Ç—Ä–µ—Ç–∏–π –≤—Å–µ–≥–¥–∞ —è–≤–ª—è–µ—Ç—Å—è –∫–æ–ø–∏–µ–π —Å–∞–º–æ–≥–æ –º–∞—Å—Å–∏–≤–∞.

–ú–µ—Ç–æ–¥ forEach - –µ—â–µ –æ–¥–∏–Ω —Å–ø–æ—Å–æ–± –ø—Ä–µ–¥—Å—Ç–∞–≤–∏—Ç—å —Ü–∏–∫–ª for –≤ JavaScript. –û–Ω –Ω–∏—á–µ–≥–æ –Ω–µ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç. –ú–µ—Ç–æ–¥ —É–ø—Ä–∞–≤–ª—è–µ—Ç —Ç–µ–º, —á—Ç–æ —É–∂–µ –µ—Å—Ç—å, –∏ —Å–æ—Ö—Ä–∞–Ω—è–µ—Ç —ç—Ç–æ –≤ –º–∞—Å—Å–∏–≤–µ, —Å –∫–æ—Ç–æ—Ä—ã–º –≤—ã —Ä–∞–±–æ—Ç–∞–µ—Ç–µ, –µ—Å–ª–∏ –≤—ã —É–∫–∞–∑—ã–≤–∞–µ—Ç–µ, —á—Ç–æ —Ö–æ—Ç–∏—Ç–µ —Å –Ω–∏–º –¥–µ–ª–∞—Ç—å.

Map

–°–∞–º—ã–π –±–ª–∏–∑–∫–∏–π –º–µ—Ç–æ–¥ –∫ forEach –º–µ—Ç–æ–¥ - —ç—Ç–æ –º–µ—Ç–æ–¥ –∫–∞—Ä—Ç—ã. –û–Ω —Ä–∞–±–æ—Ç–∞–µ—Ç –ø–æ—á—Ç–∏ —Ç–∞–∫ –∂–µ, –∑–∞ –∏—Å–∫–ª—é—á–µ–Ω–∏–µ–º —Ç–æ–≥–æ, —á—Ç–æ —ç—Ç–æ—Ç –º–µ—Ç–æ–¥ –≤–æ–∑–≤—Ä–∞—â–∞–µ—Ç –Ω–æ–≤—ã–π –º–∞—Å—Å–∏–≤. –í—Å–µ, —á—Ç–æ –≤—ã –º–∞–Ω–∏–ø—É–ª–∏—Ä—É–µ—Ç–µ –≤ —Ñ—É–Ω–∫—Ü–∏–∏ –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞, –Ω–µ –ø–æ–≤–ª–∏—è–µ—Ç –Ω–∞ –∏—Å—Ö–æ–¥–Ω—ã–π –º–∞—Å—Å–∏–≤.

–î–∞–≤–∞–π—Ç–µ –ø–æ—Å–º–æ—Ç—Ä–∏–º, –∫–∞–∫–∞—è –∫–∞—Ä—Ç–∞ —Ä–∞–Ω—å—à–µ –≤—ã–≥–ª—è–¥–µ–ª–∞ –∫–∞–∫ –¥–æ ES6:

–ö–∞–∫ –≤–∏–¥–∏—Ç–µ, –Ω–∞–º –Ω—É–∂–Ω–æ –±—ã–ª–æ —Å–æ–∑–¥–∞—Ç—å —ç–∫–∑–µ–º–ø–ª—è—Ä –Ω–æ–≤–æ–≥–æ –º–∞—Å—Å–∏–≤–∞ –≤–Ω–µ –Ω–∞—à–µ–≥–æ —Ü–∏–∫–ª–∞ for, —á—Ç–æ–±—ã –º—ã –º–æ–≥–ª–∏ –ø–æ–º–µ—â–∞—Ç—å –≤ –Ω–µ–≥–æ –Ω–æ–≤—ã–µ –∑–Ω–∞—á–µ–Ω–∏—è. –ó–∞—Ç–µ–º –Ω–∞–º –¥–µ–π—Å—Ç–≤–∏—Ç–µ–ª—å–Ω–æ –Ω—É–∂–Ω–æ –≤–µ—Ä–Ω—É—Ç—å –Ω–∞—à –Ω–æ–≤—ã–π –º–∞—Å—Å–∏–≤, —á—Ç–æ–±—ã –º–æ–∂–Ω–æ –±—ã–ª–æ –∏—Å–ø–æ–ª—å–∑–æ–≤–∞—Ç—å –µ–≥–æ –≥–¥–µ-–Ω–∏–±—É–¥—å –µ—â–µ!

–° –ø–æ–º–æ—â—å—é ES6 –∏ –º–µ—Ç–æ–¥–∞ –∫–∞—Ä—Ç—ã –º—ã –º–æ–∂–µ–º –∞–±—Å—Ç—Ä–∞–≥–∏—Ä–æ–≤–∞—Ç—å—Å—è –æ—Ç —á–∞—Å—Ç–∏ —ç—Ç–æ–π –ª–æ–≥–∏–∫–∏, —á—Ç–æ–±—ã —Å–¥–µ–ª–∞—Ç—å –µ–µ –±–æ–ª–µ–µ —á–∏—Ç–∞–µ–º–æ–π: < / p>

–û—Å–æ–±–µ–Ω–Ω–æ—Å—Ç—å –º–µ—Ç–æ–¥–∞ –∫–∞—Ä—Ç—ã, –∞ —Ç–∞–∫–∂–µ –¥—Ä—É–≥–∏—Ö –º–µ—Ç–æ–¥–æ–≤ –º–∞—Å—Å–∏–≤–∞, —Ç–∞–∫–∏—Ö –∫–∞–∫ —Ñ—É–Ω–∫—Ü–∏—è —Å–æ–∫—Ä–∞—â–µ–Ω–∏—è –∏ —Ñ–∏–ª—å—Ç—Ä–∞—Ü–∏–∏, –≤ —á–∞—Å—Ç–Ω–æ—Å—Ç–∏, –∑–∞–∫–ª—é—á–∞–µ—Ç—Å—è –≤ —Ç–æ–º, —á—Ç–æ –≤—ã –º–æ–∂–µ—Ç–µ –Ω–∞–∑–Ω–∞—á–∏—Ç—å –µ–µ –ø–µ—Ä–µ–º–µ–Ω–Ω–æ–π –∏ –≤–µ—Ä–Ω—É—Ç—å –∏–ª–∏ –ø—Ä–æ—Å—Ç–æ –≤–µ—Ä–Ω—É—Ç—å —Ü–µ–ª–∞—è —Ñ—É–Ω–∫—Ü–∏—è –≤ —Ü–µ–ª–æ–º! –ù–∏–∫–∞–∫–∏—Ö –∏–∑–º–µ–Ω–µ–Ω–∏–π –≤ –Ω–æ–≤–æ–º –º–∞—Å—Å–∏–≤–µ –Ω–µ —Ç—Ä–µ–±—É–µ—Ç—Å—è & ndash; —ç—Ç–æ —Å–¥–µ–ª–∞–Ω–æ –∑–∞ –≤–∞—Å —Å –ø–æ–º–æ—â—å—é —ç—Ç–æ–≥–æ –º–µ—Ç–æ–¥–∞ –∫–∞—Ä—Ç—ã. –ù–µ –∑–∞–±—É–¥—å—Ç–µ –∏–º–µ—Ç—å –≤–æ–∑–≤—Ä–∞—â–∞–µ–º–æ–µ –∑–Ω–∞—á–µ–Ω–∏–µ –≤ –ª–æ–≥–∏–∫–µ —Ñ—É–Ω–∫—Ü–∏–∏ –æ–±—Ä–∞—Ç–Ω–æ–≥–æ –≤—ã–∑–æ–≤–∞ –º–µ—Ç–æ–¥–∞ –∫–∞—Ä—Ç—ã!

–ó–∞–∫–ª—é—á–µ–Ω–∏–µ:

–§—É–Ω–∫—Ü–∏–∏ –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞ - —ç—Ç–æ —á—Ä–µ–∑–≤—ã—á–∞–π–Ω–æ –≤–∞–∂–Ω–∞—è –∫–æ–Ω—Ü–µ–ø—Ü–∏—è –≤ JavaScript, –∫–æ—Ç–æ—Ä–∞—è –ø–æ–º–æ–∂–µ—Ç –≤–∞–º —Å—Ç–∞—Ç—å –ª—É—á—à–∏–º —Ä–∞–∑—Ä–∞–±–æ—Ç—á–∏–∫–æ–º. –≠—Ç–æ –ø–æ–º–æ–∂–µ—Ç –∞–±—Å—Ç—Ä–∞–≥–∏—Ä–æ–≤–∞—Ç—å—Å—è –æ—Ç –Ω–µ–∫–æ—Ç–æ—Ä–æ–π –ª–æ–≥–∏–∫–∏, —á—Ç–æ–±—ã —Å–¥–µ–ª–∞—Ç—å –≤–∞—à –∫–æ–¥ –±–æ–ª–µ–µ —á–∏—Ç–∞–±–µ–ª—å–Ω—ã–º. –∏, –≤ –Ω–µ–∫–æ—Ç–æ—Ä—ã—Ö —Å–ª—É—á–∞—è—Ö, –±–æ–ª–µ–µ –ø—Ä–æ–∏–∑–≤–æ–¥–∏—Ç–µ–ª—å–Ω—ã–π.

–í —ç—Ç–æ–º —Ä—É–∫–æ–≤–æ–¥—Å—Ç–≤–µ –º—ã –∏—Å—Å–ª–µ–¥–æ–≤–∞–ª–∏ –Ω–µ–∫–æ—Ç–æ—Ä—ã–µ –∏–∑ —Ä–∞–∑–ª–∏—á–Ω—ã—Ö —Å–ø–æ—Å–æ–±–æ–≤ –Ω–∞–ø–∏—Å–∞–Ω–∏—è —Ñ—É–Ω–∫—Ü–∏–π –≤—ã—Å—à–µ–≥–æ –ø–æ—Ä—è–¥–∫–∞, –æ—Ç –±–∞–∑–æ–≤—ã—Ö –º–µ—Ç–æ–¥–æ–≤ –∫–∞–ª—å–∫—É–ª—è—Ç–æ—Ä–∞ –¥–æ –ø—Ä–æ—Å–ª—É—à–∏–≤–∞—Ç–µ–ª–µ–π —Å–æ–±—ã—Ç–∏–π –∏ —Ä–∞—Å—à–∏—Ä–µ–Ω–Ω—ã—Ö —Ñ—É–Ω–∫—Ü–∏–π –º–∞—Å—Å–∏–≤–∞. –û—Å–≤–æ–∏–≤ —ç—Ç–æ, –≤—ã –±—É–¥–µ—Ç–µ –≥–æ—Ç–æ–≤—ã –∫ –±–æ–ª–µ–µ —Å–ª–æ–∂–Ω—ã–º —Ä–µ—à–µ–Ω–∏—è–º –ø—Ä–æ–±–ª–µ–º!

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News


Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method