重构v1.0
代码优化:bottom 函数
优化一个计算布局底部位置的 JavaScript 函数。
camsong2026/8/21
代码优化TypeScript性能重构
提示词内容
提示词原样展示,配置自定义 GPT 或 Claude Project 时,分别复制对应内容
User Prompt
优化以下代码:
function bottom(layout: Layout): number {
let max = 0;
let bottomY;
for (let i = 0, len = layout.length; i < len; i += 1) {
bottomY = layout[i].y + layout[i].h;
if (bottomY > max) {
max = bottomY;
}
}
return max;
}