Best Practices
1) Always prefix your function names with fun_.
function fun_ReturnSomething() : string {
2) Always declare a return variable at the top of your function.
When you have a function that returns a value, declare a variable at the top that contains the value you will return.
function fun_ReturnSomething() : string {
let _return: string;
3) Always split your arguments and return data type onto separate lines.
When a function takes an argument, put this arguments on a new line.
Prefix any arguments with a data type prefix.
export function fun_ReturnSomthing(
aTheArray: any[],
): string {
4) Always prefix your function arguments with a data type indicator.
export function fun_ReturnSomthing(
sFontName: string,
nFontSize: number,
bIncludeTitle: boolean,
vNewObject: any,
oInsertAt: Word.Range,
): string {
For a list of all the prefixes, please refer to the Data Types page.
5) Prefix any local variables with an underscore, give them a data-type and a descriptive name.
let _firstName: string;
let _salary: number;
let _workbook: Excel.workbook;
© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext