Braces or Brackets?
Someone forgot whether to use braces or brackets and you have to clean up their code!
Start file
var some_function = function {arg1, arg2} [ var some_array = (1, 2, 3, 4, 'foo'); for {var i in some_array} ( console.log(some_array, [{1 + (8 / 2)}, 'hello (world)'); ) ];
End file
var some_function = function (arg1, arg2) { var some_array = [1, 2, 3, 4, 'foo']; for (var i in some_array) { console.log(some_array, [(1 + (8 / 2)), 'hello (world)'); } };
View Diff
1,6c1,6 < var some_function = function {arg1, arg2} [ < var some_array = (1, 2, 3, 4, 'foo'); < for {var i in some_array} ( < console.log(some_array, [{1 + (8 / 2)}, 'hello (world)'); < ) < ]; --- > var some_function = function (arg1, arg2) { > var some_array = [1, 2, 3, 4, 'foo']; > for (var i in some_array) { > console.log(some_array, [(1 + (8 / 2)), 'hello (world)'); > } > };
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 311 remaining solutions by signing in and submitting your own entry
#312 biloute02 / @biloute02 - Score: 523 - 04/27/24 @ 12:16
<Esc>:g<BS>_<BS>+<BS>!@#$<BS><BS><BS><BS>&*()<BS><BS><BS><BS>()_+<BS><BS><BS><BS>1<BS>[]\<BS><BS>!<BS><BS>1<BS>[]\'{}|<BS><BS><BS><BS><BS><BS>_)(*&^%$#@!<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>+_)(*&^%$#@!<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>%^<BS><BS>%s<BS>s.<BS>/<Esc>xu:s?<BS><BS>gs<BS><BS>5<BS>%<BS>%s<CR>:mn<BS>an :s<CR>V<Esc>:,<BS>.f<BS><BS>s<BS>g<BS>k<BS>l<BS>hl<BS>elp :c<BS>s<CR><C-D><C-U><C-D><C-D><C-D><C-U><C-U><C-U><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-D><C-U><C-U>:hie<BS><BS>u<BS>f<BS>o<BS>l<BS>e<BS>elp range<CR>:%/{/[?<BS>/g<CR>q:<Up><Right>is<CR><Esc><Esc>:q<CR>q:<Up><Up><CR>:<Esc>s<Esc>uuq:<Up><Right><Right><Right><Right><Right>r0r)r(<CR>q:<Up><Right><Right><Right>r}llr)<CR>q:<Up><Right><Right><Right>r[llr{<CR>f<Esc>q:<Down><Up><Right><Right><Right>i><BS>?<BS>'|"<BS><BS><BS><><BS><BS>/?<BS><BS>M<<BS><BS>:;<BS><BS>"|'\<BS><BS><BS><BS><Esc>/<Esc><Esc><Right><Left><Right>i-++_<BS><BS><BS><BS>!@#$%^&*()+_)(<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>:?><MM,./;l'\]<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>\\|<BS><BS><Right><Right>|<BS>\<CR>q:<Up><Right><Right><Right><Right>r]lll]}r}<CR>klr}kkA<BS>}<BS>{<Esc>p<Esc>sk<BS><Esc>jllllllrslhrJr(<Up><Up><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left><Left>r[]<Esc>wwwwwweeeeehr]<Down><Down><Left><Left><Left>r[<Esc>:c<BS>x<CR>
0 comments