Is it possible to concatenate Divhunt function outpu?

Is it possible to concatenate functions?

Let’s say we want to grab a few query parameter values and concatenate them together:

$query->get(‘firstName’) + ’ ’ + $query->get(‘lastName’)

Right now, I am thinking of creating different span elements and putting them together, but I hope there is a less tedious way :).

Thanks!

Yes, there is!

${query->get(‘firstName’)} ${query->get(‘lastName’)}

Source: REST API with variable in the URL - #2 by dejan

1 Like

@Studio350

Yes :smiley:

return ${query->get('firstName', 'John')} + ' ' + ${query->get('lastName', 'Doe')}

By writting return as first word inside content, you can execute JavaScript code. Also variables can be used, so you can do even something like this.

return ${query->get('firstName', 'John')}.charAt(0);

This would return first character of name.