Skip to content

Instantly share code, notes, and snippets.

@v-stickykeys
Created June 13, 2019 15:54
Show Gist options
  • Save v-stickykeys/f16a955ca5fa38081cba276513f5527c to your computer and use it in GitHub Desktop.
Save v-stickykeys/f16a955ca5fa38081cba276513f5527c to your computer and use it in GitHub Desktop.
JavaScript Syntax Rules
/* Comments
/**
* Describes what the function does and ends with a period.
*
* This is space to provide more explanation.
* @param { type } paramName Optionally provide more info.
* @return { type } Optionally provide more info.
*/
*/
/* Ordering
// It should be understandable when read top to bottom
// Don't make me jump around
// Prioritize alphabetical
// Logical supercedes alphabetical
*/
/* Indentation
2 spaces
Always and forever
*/
/* Arrays and Objects
// Put each item on a new line if the entire collection exceeds 70 characters in width.
[
do,
it,
like,
so,
]
// End each item with a comma, even the last one.
*/
/* Return Statements
return statement;
// Use parentheses to avoid ASI errors
return (
a + b
);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment