testmining
testmining

Reputation: 95

What is the standard naming convention of properties in a object, camelCase or snake_case?

What is the standard convention naming for property inside object?

camelCase

or

snake_case?

Here's an example:

let objPerson = {
    first_name: 'first',
    last_name: 'last'
};

or

let objPerson = {
    firstName: 'first',
    lastName: 'last'
};

Any recommendation for a site to learn naming standardization of objects? I tried to google it but couldn't find an answer. Also the name of the object should be objPerson or ObjPerson because it is an object

Upvotes: 9

Views: 7086

Answers (1)

OlaJens
OlaJens

Reputation: 108

It's not really a standard, but i've seen more snake case in my days. You can choose whatever you like, it's just important that you use the same type during a project.

Upvotes: 4

Related Questions