SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Tutorial: Preferences, Anatomy of User Defined Javascript Functions

Previous
Next

Lets look at the ifnotempty function

There is just field containing the function. All functions are defined as follows

function functionName(parameter1, parameter2, parameter 3, ....)
{

}

Here the function name is ifnotempty
It has two parameters called value and sep

The body of the function uses the if statement shorthand (known as the ternary operator)

test ? returnvalueistrue : returnvalueiftestfalse

So in this case it looks at the length of the value parameter and if it is at least one character long it returns the value plus the value of the sep parameter, if not it returns the empty string, denoted by the literal ‘’

Most SongKong customers will not need to create user defined Javascript functions, but if you do they are usually quite simple to create

Previous
Next