SlideShare a Scribd company logo
1 of 13
Download to read offline
JavaScript Style Guide
JavaScript Style Guide is a set of rules , guidelines,
programming style, practices, and methods used when writing
the source code in JavaScript .
What is JavaScript Style Guide ?
• Improves code readability
• Make code maintenance easier
• Easily shared among developers
• Naming and declaration rules for variables and functions.
• Rules for the use of white space, indentation, and comments.
• Programming practices and principles.
Style guidelines typically cover:
Coding conventions secure quality:
JavaScript Standard
Style
JavaScript style guide has linter & automatic code fixer !
Why JavaScript Standard Style ?
Advantages of JavaScript Standard Style ?
• No configuration, The easiest way to enforce consistent style
in your project.
• Automatically format code. Just run standard --fix and avoid
messy or inconsistent code.
• Catch style issues & programmer errors early. Saves code
review time by eliminating back-and-forth between reviewer
& contributor.
Rules
• Use 2 spaces for indentation.
• Use single quotes for strings
console.log('hello there')
• No unused variables.
• Add a space after keywords.
Rules,…
if (condition) { ... } // ✓ ok
if(condition) { ... } // ✗ avoid
• Add a space before a function declaration's parentheses
• Always use === instead of ==.
if (name === 'John') // ✓ ok
if (name == 'John') // ✗ avoid
function name (arg) { ... } // ✓ ok
function name(arg) { ... } // ✗ avoid
Rules,…
https://standardjs.com/rules.html#javascript-standard-style
Checking the style of all JavaScript files in the current working
directory
Usage
$ standard
Error: Use JavaScript Standard Style
lib/torrent.js:950:11: Expected '===' and instead saw '=='.
Usage-Example
—verbose| snazzy :make the output all colorful and pretty
standard:Command
“*js”:pass in a directory (or directories)
• standard --fix to fix most issues automatically
• Some errors like forgetting to handle errors)must be fixed
manually
Automatic code fixer
feross vs ECMAScript

More Related Content

Similar to JavaScript Style guides

How to write good quality code
How to write good quality codeHow to write good quality code
How to write good quality codeHayden Bleasel
 
Software development best practices & coding guidelines
Software development best practices & coding guidelinesSoftware development best practices & coding guidelines
Software development best practices & coding guidelinesAnkur Goyal
 
Web technologies-course 08.pptx
Web technologies-course 08.pptxWeb technologies-course 08.pptx
Web technologies-course 08.pptxStefan Oprea
 
WordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP HooksWordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP HooksEunus Hosen
 
Enforcing Style Guide Rules for Technical Documents
Enforcing Style Guide Rules for Technical DocumentsEnforcing Style Guide Rules for Technical Documents
Enforcing Style Guide Rules for Technical DocumentsOctavian Nadolu
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better CodeJamshid Hashimi
 
High Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeHigh Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeRainer Stropek
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)Igor Talevski
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practicesBill Buchan
 
Autoframework design
Autoframework designAutoframework design
Autoframework designForge Events
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware ProgrammingPostSharp Technologies
 
HTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsHTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsKnoldus Inc.
 
Arunan Skanthan - Roll Your own Style Guide
Arunan Skanthan - Roll Your own Style GuideArunan Skanthan - Roll Your own Style Guide
Arunan Skanthan - Roll Your own Style GuideWeb Directions
 
Software coding & testing, software engineering
Software coding & testing, software engineeringSoftware coding & testing, software engineering
Software coding & testing, software engineeringRupesh Vaishnav
 

Similar to JavaScript Style guides (20)

How to write good quality code
How to write good quality codeHow to write good quality code
How to write good quality code
 
Software development best practices & coding guidelines
Software development best practices & coding guidelinesSoftware development best practices & coding guidelines
Software development best practices & coding guidelines
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
 
Code Review for iOS
Code Review for iOSCode Review for iOS
Code Review for iOS
 
Web technologies-course 08.pptx
Web technologies-course 08.pptxWeb technologies-course 08.pptx
Web technologies-course 08.pptx
 
WordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP HooksWordPress Coding Standards & WP Hooks
WordPress Coding Standards & WP Hooks
 
Enforcing Style Guide Rules for Technical Documents
Enforcing Style Guide Rules for Technical DocumentsEnforcing Style Guide Rules for Technical Documents
Enforcing Style Guide Rules for Technical Documents
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better Code
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
High Quality C# - Codequality in Practice
High Quality C# - Codequality in PracticeHigh Quality C# - Codequality in Practice
High Quality C# - Codequality in Practice
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)TypeScript and Angular2 (Love at first sight)
TypeScript and Angular2 (Love at first sight)
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
 
Autoframework design
Autoframework designAutoframework design
Autoframework design
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming
 
HTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsHTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventions
 
Arunan Skanthan - Roll Your own Style Guide
Arunan Skanthan - Roll Your own Style GuideArunan Skanthan - Roll Your own Style Guide
Arunan Skanthan - Roll Your own Style Guide
 
Software coding & testing, software engineering
Software coding & testing, software engineeringSoftware coding & testing, software engineering
Software coding & testing, software engineering
 

More from Prem Sanil

Cpu steal time
Cpu steal timeCpu steal time
Cpu steal timePrem Sanil
 
MQTT IOT Protocol Introduction
MQTT IOT Protocol IntroductionMQTT IOT Protocol Introduction
MQTT IOT Protocol IntroductionPrem Sanil
 
IBM Watson assistant
IBM Watson assistantIBM Watson assistant
IBM Watson assistantPrem Sanil
 
Cloud service models
Cloud service modelsCloud service models
Cloud service modelsPrem Sanil
 
IBM Cloud Virtual Server/Machine - Setting up and Access
IBM Cloud Virtual Server/Machine - Setting up and AccessIBM Cloud Virtual Server/Machine - Setting up and Access
IBM Cloud Virtual Server/Machine - Setting up and AccessPrem Sanil
 
Google cloud MEAN js
Google cloud MEAN jsGoogle cloud MEAN js
Google cloud MEAN jsPrem Sanil
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC ArchitecturePrem Sanil
 
Cloud Hosted mongodb
Cloud Hosted mongodbCloud Hosted mongodb
Cloud Hosted mongodbPrem Sanil
 
Mean Stack Vs Meteor js
Mean Stack Vs Meteor jsMean Stack Vs Meteor js
Mean Stack Vs Meteor jsPrem Sanil
 
Modbus introduction
Modbus introductionModbus introduction
Modbus introductionPrem Sanil
 
Stm32f303 rest and Clock contol
Stm32f303 rest and Clock contolStm32f303 rest and Clock contol
Stm32f303 rest and Clock contolPrem Sanil
 

More from Prem Sanil (14)

Cpu steal time
Cpu steal timeCpu steal time
Cpu steal time
 
MQTT IOT Protocol Introduction
MQTT IOT Protocol IntroductionMQTT IOT Protocol Introduction
MQTT IOT Protocol Introduction
 
IBM Watson assistant
IBM Watson assistantIBM Watson assistant
IBM Watson assistant
 
Cloud service models
Cloud service modelsCloud service models
Cloud service models
 
IBM Cloud Virtual Server/Machine - Setting up and Access
IBM Cloud Virtual Server/Machine - Setting up and AccessIBM Cloud Virtual Server/Machine - Setting up and Access
IBM Cloud Virtual Server/Machine - Setting up and Access
 
Google cloud MEAN js
Google cloud MEAN jsGoogle cloud MEAN js
Google cloud MEAN js
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Nodejs
NodejsNodejs
Nodejs
 
MVC Architecture
MVC ArchitectureMVC Architecture
MVC Architecture
 
Cloud Hosted mongodb
Cloud Hosted mongodbCloud Hosted mongodb
Cloud Hosted mongodb
 
Mean Stack Vs Meteor js
Mean Stack Vs Meteor jsMean Stack Vs Meteor js
Mean Stack Vs Meteor js
 
Modbus introduction
Modbus introductionModbus introduction
Modbus introduction
 
Stm32f303 rest and Clock contol
Stm32f303 rest and Clock contolStm32f303 rest and Clock contol
Stm32f303 rest and Clock contol
 

Recently uploaded

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 

Recently uploaded (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 

JavaScript Style guides

  • 2. JavaScript Style Guide is a set of rules , guidelines, programming style, practices, and methods used when writing the source code in JavaScript . What is JavaScript Style Guide ?
  • 3. • Improves code readability • Make code maintenance easier • Easily shared among developers • Naming and declaration rules for variables and functions. • Rules for the use of white space, indentation, and comments. • Programming practices and principles. Style guidelines typically cover: Coding conventions secure quality:
  • 5. JavaScript style guide has linter & automatic code fixer ! Why JavaScript Standard Style ?
  • 6. Advantages of JavaScript Standard Style ? • No configuration, The easiest way to enforce consistent style in your project. • Automatically format code. Just run standard --fix and avoid messy or inconsistent code. • Catch style issues & programmer errors early. Saves code review time by eliminating back-and-forth between reviewer & contributor.
  • 7. Rules • Use 2 spaces for indentation. • Use single quotes for strings console.log('hello there') • No unused variables.
  • 8. • Add a space after keywords. Rules,… if (condition) { ... } // ✓ ok if(condition) { ... } // ✗ avoid • Add a space before a function declaration's parentheses • Always use === instead of ==. if (name === 'John') // ✓ ok if (name == 'John') // ✗ avoid function name (arg) { ... } // ✓ ok function name(arg) { ... } // ✗ avoid
  • 10. Checking the style of all JavaScript files in the current working directory Usage $ standard Error: Use JavaScript Standard Style lib/torrent.js:950:11: Expected '===' and instead saw '=='.
  • 11. Usage-Example —verbose| snazzy :make the output all colorful and pretty standard:Command “*js”:pass in a directory (or directories)
  • 12. • standard --fix to fix most issues automatically • Some errors like forgetting to handle errors)must be fixed manually Automatic code fixer