0% found this document useful (0 votes)
7 views1 page

JavaScript Rules Quick Guide

This quick guide outlines best practices for writing SQL code, emphasizing the use of modern JavaScript features such as let, const, and arrow functions. It advises on error handling, variable naming conventions, and the importance of avoiding global variables. Additionally, it recommends using linters for code quality and maintaining consistent formatting.

Uploaded by

yassinbh1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

JavaScript Rules Quick Guide

This quick guide outlines best practices for writing SQL code, emphasizing the use of modern JavaScript features such as let, const, and arrow functions. It advises on error handling, variable naming conventions, and the importance of avoiding global variables. Additionally, it recommends using linters for code quality and maintaining consistent formatting.

Uploaded by

yassinbh1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL Rules - Quick Guide

- Always declare variables using let, const (avoid var).

- Use const for variables that dont change.

- Use === and !== instead of == and !=.

- Always end statements with a semicolon (;).

- Use camelCase for naming variables and functions.

- Function and variable names should be meaningful.

- Use strict mode: "use strict"; at the top of your files.

- Avoid global variables.

- Wrap code in functions or modules to avoid polluting the global scope.

- Use arrow functions ()=>{} for simple functions.

- Handle errors using try...catch.

- Always check for null or undefined.

- Use let for loop counters (e.g., for (let i = 0; i < n; i++)).

- Prefer template literals `Hello, ${name}` over string concatenation.

- Avoid deeply nested callbacks use Promises or async/await.

- Use console.log() only for debugging remove in production.

- Document your code with comments.

- Follow consistent indentation (2 or 4 spaces).

- Use linters like ESLint for code quality.

- Test your code regularly.

Page 1

You might also like