11. Hungarian Notation
Since JavaScript is a dynamic language where you cannot explicitly specify variable types, it has become a standard in the UI5 community to use Hungarian notation for readability.
The idea is to explicitly show the variable type by the first letters of its name.
| Variable Name | Data Type |
|---|---|
| sId | string |
| oDomRef | object |
| $DomRef | jQuery object |
| iCount | int |
| mParameters | map / assoc. array |
| aEntries | array |
| dToday | date |
| fDecimal | float |
| bEnabled | boolean |
| rPattern | RegExp |
| fnFunction | function |
| vVariant | variant types |
In TypeScript projects, this notation is pointless, since types are checked at compile time. But in regular JavaScript projects, it is strongly recommended to continue using Hungarian notation.
Additionally: For describing methods and their arguments, I recommend using JSDOC (AI tools have become quite good at generating JSDOC. It would be a crime to neglect it!)