HOWPROGRAMMINGWORKS Telegram 1789
HowProgrammingWorks - JavaScript and Node.js Programming
🧩 Практический мастер-класс Паттерны в JavaScript и TypeScript Начало: в эту субботу 2025-03-22 в 15:00 (Киевское время) 👳 Тимур Шемсединов 🥷 Илья Климов 🧔‍♂️ Дмитрий Нечай Изучение Патернов помогает: Писать более понятный код, который просто читать…
У кого не выходит выбрать язык на лендинге курса, можете сделать это в консоли, при помощи паттернов, самое базовое решение тут, но вы не останавливайтесь:

class Maybe {
  constructor(value) {
    this.value = value;
  }

  static of(value) {
    return new Maybe(value);
  }

  map(fn) {
    return this.value ? Maybe.of(fn(this.value)) : this;
  }

  getValue(defaultValue) {
    return this.value || defaultValue;
  }
}

class SelectCommand {
  constructor(selector, value) {
    this.selector = selector;
    this.value = value;
  }

  execute() {
    return Maybe.of(document.querySelector(this.selector))
      .map(el => (el.value = this.value, el))
      .map(el => el.dispatchEvent(new Event('change', { bubbles: true })))
      .getValue(null);
  }
}

const lang = 'RU'; // or UKR

new SelectCommand('.form-select-arrow', lang).execute();



tgoop.com/HowProgrammingWorks/1789
Create:
Last Update:

У кого не выходит выбрать язык на лендинге курса, можете сделать это в консоли, при помощи паттернов, самое базовое решение тут, но вы не останавливайтесь:

class Maybe {
  constructor(value) {
    this.value = value;
  }

  static of(value) {
    return new Maybe(value);
  }

  map(fn) {
    return this.value ? Maybe.of(fn(this.value)) : this;
  }

  getValue(defaultValue) {
    return this.value || defaultValue;
  }
}

class SelectCommand {
  constructor(selector, value) {
    this.selector = selector;
    this.value = value;
  }

  execute() {
    return Maybe.of(document.querySelector(this.selector))
      .map(el => (el.value = this.value, el))
      .map(el => el.dispatchEvent(new Event('change', { bubbles: true })))
      .getValue(null);
  }
}

const lang = 'RU'; // or UKR

new SelectCommand('.form-select-arrow', lang).execute();

BY HowProgrammingWorks - JavaScript and Node.js Programming


Share with your friend now:
tgoop.com/HowProgrammingWorks/1789

View MORE
Open in Telegram


Telegram News

Date: |

“Hey degen, are you stressed? Just let it all out,” he wrote, along with a link to join the group. Telegram is a leading cloud-based instant messages platform. It became popular in recent years for its privacy, speed, voice and video quality, and other unmatched features over its main competitor Whatsapp. A Hong Kong protester with a petrol bomb. File photo: Dylan Hollingsworth/HKFP. Healing through screaming therapy You can invite up to 200 people from your contacts to join your channel as the next step. Select the users you want to add and click “Invite.” You can skip this step altogether.
from us


Telegram HowProgrammingWorks - JavaScript and Node.js Programming
FROM American