Reactiflux
Reactiflux

help-js

Root Question Message

bfrisco
bfrisco1/1/2023
Is there a purpose of what I am dubbing as "blanket brackets" within functions? Example:
await socket.connect({host, port, timeout: 5000});
{ // <--- what is this?
  socket.writeVarInt(0x00);
  socket.writeVarInt(50);
  // ...
}

let response;
// ...

I've seen this a couple times in open source repos, wondering if that's just an oversight or if this actually does something.
Message Not Public

Sign In and Join Server To See

1/1/2023
Message Not Public

Sign In and Join Server To See

1/1/2023
bfrisco
bfrisco1/1/2023
If no variables are defined inside of it, is it just meaningless then?
Message Not Public

Sign In and Join Server To See

1/1/2023
bfrisco
bfrisco1/1/2023
From a functional standpoint
bfrisco
bfrisco1/1/2023
Ok, thanks
bfrisco
bfrisco1/1/2023
Ah okay, I do see comments on top of each now. It must just be a visual thing like you said.

Nice to know about the variable scoping though.
Message Not Public

Sign In and Join Server To See

1/1/2023
Message Not Public

Sign In and Join Server To See

1/1/2023
bfrisco
bfrisco1/1/2023
In this case it makes a lot of sense (writing packets)
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy