TGViewer
HowProgrammingWorks - JavaScript and Node.js Programming HowProgrammingWorks - JavaScript and Node.js Programming @howprogrammingworks · 6.51K subscribers
Post #1823 3.97K
Кто узнает в этом коде плохие практики?
Если не узнаете, и вам все ок, то смотрите в репозиторий, там список и как исправить https://github.com/HowProgrammingWorks/GoodParts/blob/main/JavaScript/1-func-bad.js
const getPrice = function(options = { convert: true }) {
let price;
let item = { price } = this;
if (!Array.isArray(item)) {
let { price } = this;
if (typeof price == 'number') return price;
price = this.cost;
if (typeof price == 'number') return price;
if (options.convert) return parseFloat(price);
}
[, price] = this;
if (typeof price == 'number') return price;
if (options.convert) price = +price;
if (!isNaN(price)) return price;
};
  • 👍 5
  • ❤ 3
  • 🤯 3
  • 🔥 1
More from @howprogrammingworks
  1. Oct 2, 2026Dashboard with real-time monitoring Released in reslop v0.2.6 https://github.com/tshemsedi…
  2. Oct 2, 2026video post
  3. Oct 1, 2026Что AI научился делать действительно хорошо, так это максимально отсрочить катастрофу в пр…
  4. Sep 30, 2026Тут пример, как я сделал рефакторинг reslop при помощи - Opus 5.5 как старшая модель - Gro…
  5. Sep 29, 2026Каждое ваше ревью слопа должно превращаться в скилл и в следующий раз уже вас не спрашиват…
  6. Sep 28, 2026В версии reslop v0.2.4 появилась возможность запускать тесты и инструменты с компактным вы…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →