Skip to content

Instantly share code, notes, and snippets.

@serby
Last active December 26, 2015 23:49
Show Gist options
  • Save serby/7233181 to your computer and use it in GitHub Desktop.
Save serby/7233181 to your computer and use it in GitHub Desktop.

Clock JavaScript/JSON Naming Guide

Please ensure you are familiar with our JavaScript styleguide. This guide builds on top of that document and aims to advise on the semantic naming of variable, objects, properties, classes and functions.

Glossary

Object

From Mozilla's JavaScript Glossary

In the context of a constructor, an instance of that constructor. Otherwise, an unordered collection of properties. To be more specific, an object is an associative array, where the keys are property names, and the values are property values. All objects are derived from Object, including arrays, and Object itself is also an object.

Variable

From Mozilla's JavaScript Glossary

A placeholder where a value can be stored. In JavaScript, variables are actually properties. Variables are typically accessed through identifiers. See also global variable and local variable.

var i = 0
  , count = 0
  , users

Function

From Mozilla's JavaScript Glossary

A body of code that can be called by other code or by itself, or a variable that refers to the function. When a function is called, arguments are passed to the function as input, and the function can optionally return an output. A function is also an object.

JSON

JSON has properties and values. Values can be primities, objects or arrays.

Verb Phrase

Naming

Functions

User-defined functions and methods are named in the same style as variables; however they are usually verbs-phrases instead of noun-phrases.

Copy link

ghost commented Oct 30, 2013

should work, too:</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment