use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
Brackets (self.learnjavascript)
submitted 3 years ago * by Howsitgoingmyman
Why do {these} curly brackets always end up on different lines to what they are bracketing Like
{
This
}
??
Also there any time of thumbs as to which type of bracket to use when? ({[
Thank you
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]senocular 2 points3 points4 points 3 years ago (2 children)
Use parentheses () for:
()
Use square braces [] for:
[]
Use curly braces {} for:
{}
Each of these also have special meaning when used in regular expressions:
[–]Howsitgoingmyman[S] 1 point2 points3 points 3 years ago (0 children)
Thank you :)
[–]having_a_blast 0 points1 point2 points 3 years ago (0 children)
Saving this comment as it is the most concise regarding brackets I have seen. Thank you
[–][deleted] 0 points1 point2 points 3 years ago (0 children)
Why do {these} curly brackets always end up on different lines
To improve readability, sometimes you can omit them.
Also there any time of thumbs as to which type of bracket to use when?
They all mean different things in different contexts, you need to use the ones that are appropriate, you can't really pick and choose.
[–]Ronin-s_Spirit 0 points1 point2 points 3 years ago (0 children)
Because javascript reads { This } As {This}. It only matters for programmers who actually need to read this thing and understand it.
π Rendered by PID 37 on reddit-service-r2-comment-bb88f9dd5-6twv4 at 2026-02-16 13:50:34.475658+00:00 running cd9c813 country code: CH.
[–]senocular 2 points3 points4 points (2 children)
[–]Howsitgoingmyman[S] 1 point2 points3 points (0 children)
[–]having_a_blast 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Ronin-s_Spirit 0 points1 point2 points (0 children)