How to name variables, functions and classes?

// boolean: in form of a question
const isVisible = true
const hasChildren = false

// constant: a true constant value
const EULER_NUMBER = Math.E
const PI = Math.PI

// string: singular
const simpleString = 'Hello World'
const anotherString = 'Lorem ipsum'

// object: mostly singular
const someData = {...}

// array: always plural
const arrayItems = [...].map(item => item)
// function: combination of verb and noun          
function getData() {...}
function findUser() {...}

// class: first letter is always capital
class ClassName {...}

October 4th, 2019

# Naming convention

Add to bookmarks

It's always good to have a naming convetion so you can immediately see if you're working with a class, function or a boolean.