I am creating calling a function and passing in an array of objects but i am unsure if to use camingCasing or PascalCasing. Here is my method
util.load({
DefaultText:'Empty',
Items:[
{
Id:0,
Title:'Press'
}
]
});
If you notice i am passing in DefaulText, but should it be defaultText? and also Items, should it be items? and within the Items and i am also passing in Id and Title.
Can anyone confirm the correct way of doing this?
I know that methods are camelCasing but passing in objects like above?
Thanks in advance
The very popular JavaScript convention is to use PascalCasing as you call it for constructors (classes), for example String, Number, Date and camel casing for variable names and object keys. This code convention is used for all the built-in JavaScript functionality in the modern browsers, so thats why I would recommend to use it for your own code too.
There is no one correct way.
The JavaScript API uses camelCase for functions and PascalCase for objects.
Just choose one and be consistent. JavaScript identifiers are case sensitive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With