Add code golf challenges for Vim practice, a weekly review template, and extend the cheatsheet with high-frequency commands. Fix the calculator `multiply` implementation and correct a logger import path.
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
// ============================================================
|
|
// Code Golf 场景 5:删除所有 console.log
|
|
// ============================================================
|
|
//
|
|
// 目标:删除函数体内所有 console.log 语句,用最少按键。
|
|
//
|
|
// 💡 提示:g l 选中所有 console.log → d 删除它们!
|
|
// 或者::g/console\.log/d 全局删除匹配行
|
|
// ============================================================
|
|
|
|
function process(): void {
|
|
console.log("Starting...");
|
|
const a = doThing();
|
|
console.log("After thing:", a);
|
|
const b = doOtherThing();
|
|
console.log("After other:", b);
|
|
console.log("Done!");
|
|
return b;
|
|
}
|
|
|
|
function doThing(): number {
|
|
return 42;
|
|
}
|
|
|
|
function doOtherThing(): number {
|
|
return 84;
|
|
}
|
|
|
|
// === 目标代码 ===
|
|
//
|
|
// function process(): void {
|
|
// const a = doThing();
|
|
// const b = doOtherThing();
|
|
// return b;
|
|
// }
|
|
//
|
|
// ============================================================
|
|
// 我的最佳成绩:
|
|
// 日期: ________ 按键数: ________
|
|
// 操作日志: ________________________________
|
|
// ============================================================
|