Mission 28 / 52• Text Objects - Bracket Pairs

Delete Inside Brackets

`di{` (or `di}`) deletes everything between curly braces while keeping the braces intact.

It works with parentheses (`di(` or `di)`) and square brackets (`di[` or `di]`) as well!

Delete inside brackets

  • di{delete inside curly braces { ... }
  • di(delete inside parentheses ( ... )
  • di[delete inside square brackets [ ... ]
1
function calculateDiscount(price, user) {
2
const base = price * 0.9;
3
return base;
4
}

Place cursor anywhere inside the function body and type `di{`. The entire contents vanish, leaving empty `{}`!

Now it's your turn!

0 / 4 tasks complete0.0s / 16s par0 / 17 par

Practice this lesson's commands. Each task checks your technique and the result, not just your cursor position. Take your time.

Task 1: Clear the arguments with di( while keeping the parentheses.

Expected result
send();
Show hint

Use di( inside the argument list.

1
send(message, retry);
jkscroll•ggGtop/bottom•Tabnext example•Enterstart•qstop•Ctrl+kCtrl+jprev/next