• Skip to main content
  • Skip to primary sidebar

Founder at work

Master the skills to create and launch your next SaaS company

  • About Me
  • Reviews
  • Resources
  • Community
  • Contact
  • Lessons
  • Series
  • Search
  • Login

Naming Conventions in Programming

August 9, 2016 by Rick Hernandez Leave a Comment

Naming Conventions
JavaScript does not have any specific rules for naming variables; however, other languages do. Naming conventions help your code stay fluent within the context of your program. This is important because you want to have consistency throughout your entire program. Below you will find general rules when naming your variables.

  1. Variables tend to start with a letter.
  2. Spaces are not allowed in variables
  3. Special characters such as “!,-,@” are not allowed in the name
  4. Digits are allowed but keep Rule number 1 in mind.

Example of valid names

user
total
output
results

Example of invalid names

Becky Johnson
output!
12Users
first-name

Variable names should clearly express how the variable is going to be used. For example, the following names are valid but not typically a good idea to use:

tuna = 32

TheResultsFromACalculationWithALongName = ((32 + x) / 5)

Rick Hernandez

I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Filed Under: JavaScript, JSecademy, Programming, Programming Fundamentals

Primary Sidebar

Learn How To Take Your Idea And Convert It Into An App From Scratch Even If You Have Never Written A Single Line Of Code.

  • How to Find Your Next Great App Idea
  • The Secret To Getting PAID To Build Your Own App
  • How To Create Your App (SaaS, Mobile, VR, AR, Game)
  • How To Monetize Your Apps
Learn More
4.82 Ratings

Copyright © 2025 · JSecademy Blog Theme on Genesis Framework · WordPress · Log in